Skip to content
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

DropdownMenuV2: remove flashing styles when moving focus with keyboard #64873

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

### Internal

- `DropdownMenu` v2: fix flashing menu item styles when using keyboard ([#64873](https://github.com/WordPress/gutenberg/pull/64873)).
- `DropdownMenu` v2: refactor to overloaded naming convention ([#64654](https://github.com/WordPress/gutenberg/pull/64654)).
- `Composite` V2: fix Storybook docgen ([#64682](https://github.com/WordPress/gutenberg/pull/64682)).

Expand Down
15 changes: 11 additions & 4 deletions packages/components/src/dropdown-menu-v2/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,23 @@ const baseItem = css`
cursor: not-allowed;
}

/* Hover */
&[data-active-item]:not( [data-focus-visible] ):not(
/* Active item (including hover)
* Note: we should be able to remove :focus-visible once
* https://github.com/ariakit/ariakit/issues/4083 is fixed and released
*/
&[data-active-item]:not( [data-focus-visible] ):not( :focus-visible ):not(
[aria-disabled='true']
) {
background-color: ${ COLORS.theme.accent };
color: ${ COLORS.white };
}

/* Keyboard focus (focus-visible) */
&[data-focus-visible] {
/* Keyboard focus (focus-visible)
* Note: we should be able to remove :focus-visible once
* https://github.com/ariakit/ariakit/issues/4083 is fixed and released
*/
&[data-focus-visible],
&:focus-visible {
box-shadow: 0 0 0 1.5px ${ COLORS.theme.accent };

/* Only visible in Windows High Contrast mode */
Expand Down
Loading