Skip to content

Apply focus styling more consistently#593

Open
mkernohanbc wants to merge 2 commits intomainfrom
feature/focus-handling
Open

Apply focus styling more consistently#593
mkernohanbc wants to merge 2 commits intomainfrom
feature/focus-handling

Conversation

@mkernohanbc
Copy link
Contributor

This PR makes changes to 5 components to handle focus states more consistently. Affected components are:

  • Checkbox
  • Select
  • Tag
  • TextArea
  • TextField

The key change is to the conditions for applying the offset focus ring, like this:

Screenshot 2025-12-17 at 2 53 47 PM

In these (mostly older) components, we previously used the RAC data attribute [data-focused] to apply this style. This triggers whenever the element is in focus, whether via keyboard or via the user clicking into it, etc.

This change updates these components to instead use the attribute [data-focus-visible], which applies more narrowly only when the element is keyboard-focused. This is the approach we have adopted for most of our more recent components.

TextField in non-keyboard focus ([data-focused]):
Screenshot 2025-12-17 at 2 53 08 PM

TextField in keyboard focus ([data-focus-visible]):
Screenshot 2025-12-17 at 2 52 59 PM

This change preserves the functionality of clearly indicating where focus is for users navigating via keyboard, but reduces visual load for other users (letting hover, border and cursor visual cues handle the task.)

@mkernohanbc mkernohanbc added this to the Components v0.6.0 milestone Dec 17, 2025
@mkernohanbc mkernohanbc self-assigned this Dec 17, 2025
@mkernohanbc mkernohanbc added the Components Changes or issues affect the design-system-react-components package label Dec 17, 2025
@mkernohanbc
Copy link
Contributor Author

@Philip-Cheung let's touch base in the new year, and confirm we're being consistent (in code and Figma, and from component to component.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Components Changes or issues affect the design-system-react-components package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant