This repository was archived by the owner on Sep 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Properly handle buttons with aria-disabled
in focus helpers
#7760
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size-limit report 📦
|
…ocus helpers Fixes #7728
e0c68d4
to
a5425f5
Compare
5 tasks
kyledurand
approved these changes
Nov 18, 2022
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 but I pinged a couple other folks who have more context
Co-authored-by: Kyle Durand <kyledurand@users.noreply.github.com>
AndrewMusgrave
approved these changes
Nov 18, 2022
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! ✅
zakwarsame
approved these changes
Nov 18, 2022
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.
Thanks for the update here @acmertz 👍🏾
I remember the shopify-web
team (or a different team) updating this throughout the web
before releasing that polaris version.
zakwarsame
reviewed
Nov 18, 2022
zakwarsame
reviewed
Nov 18, 2022
chloerice
approved these changes
Nov 18, 2022
Co-authored-by: zak warsame <42528878+zakwarsame@users.noreply.github.com>
Merged
This was referenced Nov 30, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
Fixes #7728
WHAT is this pull request doing?
Earlier this year, #6461 changed disabled buttons to use a combination of
aria-disabled="disabled"
andtabindex="-1"
instead of thedisabled
attribute to make them more accessible for keyboard and screen reader users. This caused the focus-related helper functions infocus.ts
to incorrectly identify disabled Polaris<Button>
components as focusable, which in turn broke focus trapping (see #7728).This PR updates a CSS query defined in
focus.ts
to exclude buttons withtabindex="-1"
when querying focusable elements so that disabled Polaris buttons are no longer selected.How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx
:Playground.tsx
and runyarn dev
🎩 checklist
README.md
with documentation changes