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

Make Button and ItemGroup 'Item as a button` focus indication consistent #67747

Open
2 of 6 tasks
afercia opened this issue Dec 9, 2024 · 0 comments
Open
2 of 6 tasks
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Dec 9, 2024

Description

Splitting this out from #67513 (comment)

The Button component uses :focus for the focus state, so that the focus style is shown also when using the mouse.

Instead, when the ItemGroup item is rendered as a button via the as prop, it uses :focus-visible so that the focus style is supposed to be shown only when using the keyboard.

As such, the focus indication behavior is inconsistent. I'd tend to think all the components from the components package should use a consistend focus indication behavior.

Step-by-step reproduction instructions

  • Edit a post, select an Image block and go to the block settings panel > Styles.
  • Click and hold your mouse on the 'Duotone' button.
  • Note: this button element is a Button component.
  • Observe the focus style is visible while holding the mouse pressed.
  • Switch to this PR's branc Fix incorrect usage of ItemGroup in the Image block filters panel. #67513 if it hasn't been merged yet.
  • Repeat the steps above.
  • Note: the Duotone button is now an ItemGroup > Item component rendered as a button element.
  • Observe the focus style is not shown when holding the mouse pressed on the button.
  • Observe the focus style is only shown when using the keyboard.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@afercia afercia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components [Type] Bug An existing feature does not function as intended labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant