Repository navigation
DropdownMenuV2: remove flashing styles when moving focus with keyboard - #64873
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
cc @diegohaz — do you have any insights on why this is happening, and if there is a better fix? |
Yes, |
Sure — here it is: ariakit/ariakit#4083 |
af10bc2 to
e03508b
Compare
WordPress#64873) * DropdownMenuV2: remove flashing styles when moving focus with keyboard * CHANGELOG * Add comment about ariakit issue --- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: diegohaz <hazdiego@git.wordpress.org>
What?
Part of #50459
Removing "flash of unwanted styles" when navigating
DropdownMenuV2items using the keyboard.Why?
While working on
DropdownMenuV2, I noticed that menu items would sometimes flash briefly with the "active (hover)" styles, before applying the expected "focus-visible" styles — ie. it seems that the underlying ariakit implementation doesn't apply thedata-focus-visibleattribute soon enough, and therefore the focus-visible styles are applied with a delay, causing the hover (active) styles to apply for a few frames.How?
I removed the flash by using the native
:focus-visibleCSS selector, which matches without any delays.Testing Instructions
In Storybook, interact with the DropdownMenuV2 examples using keyboard, moving across the menu items.
On trunk, you could sometimes see the aforementioned flash — with the changes from this PR, the flash should never happen.
Screenshots or screencast
ddmv2.flash.before.mp4
ddmv2.flash.after.mp4