-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(react-button): update active state styles to include keyboard press events #35514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(react-button): update active state styles to include keyboard press events #35514
Conversation
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
| }, | ||
|
|
||
| ':hover:active': { | ||
| ':hover:active,:active:focus-visible': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls use Fluent UI focus indicator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not totally sure that's feasible here, since I'd have to duplicate all the :active styles - unless I'm overlooking something? Also, I don't actually need the focus outline styles here, just want to fix this edge case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jurokapsiar, could you clarify why you think we should use the focus indicator style hooks here? Just so we're on the same page, this update isn’t about styling the focus state - it’s just for applying the :active state to the button, either when the clicks on the button and the pointer’s over it (introduced in #22574) or when a user presses space/enter while the button’s focused (this PR).

Previous Behavior
Button's active state is only visible when mouse is hovering a button (introduced in #22574)
Demo - active state is not visible when button is focused and a user presses space:
Screen.Recording.2025-11-25.at.9.59.29.mov
New Behavior
Button's active state is visible when mouse is hovering a button or when the button has
:focus-visible. This allows us to show active state on keyboard press without breaking the behavior introduced #22574Demo - active state is visible when mouse is hovering a button or when a user presses "space" on focused button
Screen.Recording.2025-11-25.at.9.58.38.mov
Related Issue(s)