-
Notifications
You must be signed in to change notification settings - Fork 83
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
feat!: use role attribute instead of native button #2394
Conversation
598b6f9
to
3a274ba
Compare
Just a note: if you change the underlying implementation from a native |
@knoobie Thank you for the feedback!
Currently, the button inherits |
1a08a33
to
acec79c
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯
This ticket/PR has been released with platform 22.0.0.alpha2 and is also targeting the upcoming stable 22.0.0 version. |
Introduction
There are 2 approaches suggested by Tetralogical (#132) on how to organize the HTML structure of the button so that it would become more accessible for screen readers.
1st approach (prototyped and currently used in
@vaadin/button
):The approach is based on the native
<button>
element.2nd approach:
The approach is based on the
[tabindex=0]
and[role=button]
attributes which should be set on the button host.While the current implementation of the button is based on the 1st approach (with the native button), this approach supposes us to make some changes in the Lumo and Material themes (moving
padding
from the host on the native button in particular) in order to adjust them for the new HTML structure.The 2nd approach, on the other hand, doesn't suppose any changes in the themes and also allows us to get rid of
ControlStateMixin
in favor of the modernTabIndexMixin
,FocusMixin
.The 2nd approach also provides a more convenient HTML structure that makes easier the future removal of the
<span>
wrappers, see #955 (comment).This PR aims at giving an implementation for the 2nd approach as it has been considered to be more advantageous.
Part of #2224
Related a11y issues
Type of change
Checklist
Additional for
Feature
type of change