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

Tertiary button is-pressed style insufficient contrast ratio on hover #68535

Open
2 of 6 tasks
afercia opened this issue Jan 7, 2025 · 3 comments · May be fixed by #68542
Open
2 of 6 tasks

Tertiary button is-pressed style insufficient contrast ratio on hover #68535

afercia opened this issue Jan 7, 2025 · 3 comments · May be fixed by #68542
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Design Needs design efforts. [Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Jan 7, 2025

Description

Discovered while working on #68531

The tertiary button style variant can have (like all other variants) a pressed state. With this styling, the button background becomes a dark grrey. However, when hovering the button, the button text becomes blue. It is barely visible:

Image

This appears to happen only with the tertiary variant. For the other variants, the text stays whie on hover.

Step-by-step reproduction instructions

  • Go to https://wordpress.github.io/gutenberg/?path=/story/components-button--tertiary&args=aria-pressed:true
  • Make sure the aria-pressed prop is true.
  • Hover the button.
  • Observe the text becomes blue on a dark gray background.
  • Alternatively, go to the Post editor.
  • Enable the preference Show button text labels from the top bar Options > Preferences > Accessibility.
  • Make sure the Settings panel is open by clicking 'Settings' in the top bar.
  • Hover the Settings button and observe the text becomes blue on a dark gray background.

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 Needs Design Needs design efforts. labels Jan 7, 2025
@patil-vipul
Copy link

patil-vipul commented Jan 7, 2025

@afercia I've verified the issue for the tertiary variant for the hover state as shown below.

Image

However, the pressed or clicked state changes the button style to outline.

Image

I've tested this on the latest version of WordPress (6.7.1). I'll raise the PR for the same.

@yogeshbhutkar
Copy link
Contributor

I believe the following line is overriding the color property set by is-pressed rule:

color: $components-color-accent-darker-20;

This shouldn't be applied when is-pressed is set as it already applies the color and background properties.

&.is-pressed {
&,
&:hover {
color: $components-color-foreground-inverted;
&:not(:disabled, [aria-disabled="true"]) {
background: $components-color-foreground;
}
}

@yogeshbhutkar
Copy link
Contributor

Thank you, @patil-vipul, for testing the issue and apologies for submitting this PR after you had already committed to raising it. While reviewing the bug, I noticed a simple one-line fix and decided to create this quick PR.

That said, I’m open to exploring better solutions and would love to collaborate further to address this issue effectively.

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). Needs Design Needs design efforts. [Package] Components /packages/components [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants