-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Button: Never apply aria-disabled
to anchor
#63376
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Flaky tests detected in f1ddeaa. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9879092432
|
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.
Makes sense to me and work as intended!
Random idea for discussion, tangential to this PR, but do you think it'd be possible to use an Ariakit button underneath? We might be able to delegate many of these behaviors (like accessibleWhileDisabled), plus get a few potential safeguards or a11y features out of the box and reduce our maintenance area. Not sure if there'd be any significant trade-offs.
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.
Makes sense to me and work as intended!
Random idea for discussion, tangential to this PR, but do you think it'd be possible to use an Ariakit button underneath? We might be able to delegate many of these behaviors (like accessibleWhileDisabled), plus get a few potential safeguards or a11y features out of the box and reduce our maintenance area. Not sure if there'd be any significant trade-offs.
Github decided to duplicate my review 😆 |
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.
Makes sense. Thanks for making this behavior clearer through a unit test 👍
That is an alluring idea, although |
Basically agree with @ciampo. But my instinct is that Ariakit is not going to make a big difference here, because most of the complexity of Button is in the prop bloat and the styles 😅 |
* Button: Never apply `aria-disabled` to anchor * Add changelog Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: DaniGuardiola <daniguardiola@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>
Fixes #62281
What?
Prevents link (anchor) buttons from ever having an
aria-disabled
attribute.Why?
<Button href="foo">
automatically renders an anchor element, whereas<Button href="foo" disabled>
will remain a button element, because anchor elements cannot be disabled. Neitherdisabled
noraria-disabled
are valid attributes on an anchor.However, there was a bug where
<Button href="foo" disabled accessibleWhenDisabled>
rendered an anchor with anaria-disabled
attribute.Testing Instructions
See the Storybook for
Button
and see what happens when you render<Button href="foo" disabled accessibleWhenDisabled>
.✅ New unit test should also pass.