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

fix: set aria-hidden="true" on prefix and suffix #5049

Merged
merged 1 commit into from
Nov 18, 2022

Conversation

web-padawan
Copy link
Member

Description

Fixes #2924

See #2924 (comment) for a confirmation by @knoobie that this approach works in NVDA.

Given that prefix and suffix are not announced in field components and are typically used for icons (or supplementary content, e.g. $ currency sign in case of the money field), let's change vaadin-button to work the same way.

Type of change

  • Bugfix

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@@ -98,13 +98,13 @@ class Button extends ButtonMixin(ElementMixin(ThemableMixin(ControllerMixin(Poly
}
</style>
<div class="vaadin-button-container">
<span part="prefix">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note if someone comes around this with the question:

But isn't this a problem for icon-only buttons?

For accessible icon-only buttons it was already mandatory to add an aria-label to the vaadin-button element.

Copy link
Member Author

@web-padawan web-padawan Nov 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, for icon-only buttons, it's still possible to place the icon inside a default slot (at least in the web component). The Flow component uses prefix or suffix for setIcon() - by default, it's prefix.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, providing an accessible name for the icon itself has worked before, but the recommended approach has always been to set aria-label on the button instead.

@rolfsmeds
Copy link
Contributor

rolfsmeds commented Nov 18, 2022

I created an issue for adding mentions of prefix+suffix announcements in docs: vaadin/docs#1902

@web-padawan web-padawan removed the request for review from vursen November 18, 2022 08:36
@web-padawan web-padawan merged commit c844b49 into master Nov 18, 2022
@web-padawan web-padawan deleted the fix/button-aria-hidden branch November 18, 2022 08:36
web-padawan added a commit that referenced this pull request Nov 18, 2022
web-padawan added a commit that referenced this pull request Nov 18, 2022
web-padawan added a commit that referenced this pull request Nov 18, 2022
web-padawan added a commit that referenced this pull request Nov 18, 2022
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.0.0.alpha5 and is also targeting the upcoming stable 24.0.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[button] NVDA repeats the "button" word numerous times
5 participants