-
Notifications
You must be signed in to change notification settings - Fork 233
fix(pending-state): correct reflection of aria in pending controller #5730
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: e327b6e The changes in this PR will be included in the next version bump. This PR includes changesets to release 84 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📚 Branch Preview🔍 Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
Tachometer resultsCurrently, no packages are changed by this PR... |
'@spectrum-web-components/button': patch | ||
'@spectrum-web-components/reactive-controllers': patch |
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.
nit: Will this be read with our current changelog script? Would you prefer adding separate changeset for each package instead?
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.
there are other changesets with mulitple packages, i dont think it should be an issue
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.
I think what Rajdeep means is, even though this works, our change log script does not pick up multiple packages (only the first one).
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.
I really like how this has come together.
One suggestion: Would you like to add a quick screen reader test video to the PR. This would help the original reporter (and future contributors) to verify the behavior.
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.
Nice work! I left one blocking comment: could we confirm the double label behavior?
cached: string | null, | ||
current: string | null, | ||
pending: string | undefined | ||
): string | boolean | null { |
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.
Are the possible return values accurate? string | boolean | null
?
pending: string | undefined | ||
): string | boolean | null { | ||
return ( | ||
(!cached && current && current !== pending) || |
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.
current && ...
treats ""
as false
. Is an empty string invalid? Or do we need to treat null
/undefined
differently from an empty string?
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.
If an empty string, maybe we can add a test to cover that?
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.
current !== "" && ...
* Renders the pending state UI. The aria-valuetext is needed for Firefox | ||
* @returns A TemplateResult representing the pending state UI. | ||
* | ||
* @TODO: [SWC-1255] This should now be using the progress-circle component. It should be using an animated SVG icon with correct role and aria. |
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.
nit:
* @TODO: [SWC-1255] This should now be using the progress-circle component. It should be using an animated SVG icon with correct role and aria. | |
* @TODO: [SWC-1255] This should not be using the progress-circle component. It should be using an animated SVG icon with correct role and aria. |
(also, this todo is very prescriptive of the solution, even though I don't think we have complete clarity on the path forward her)
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.
i can change the language
public cachedAriaLabel: string | null = null; | ||
/** | ||
* Renders the pending state UI. | ||
* Renders the pending state UI. The aria-valuetext is needed for Firefox |
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.
The aria-valuetext is needed for Firefox
I'm curious, why?
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.
because firefox reads indeterminate as 50 and value text will override that for screen readers, again this is part of the accessibility issue with using pending-circle
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.
role = ""
aria-hidden="true"
Description
This PR fixes aria-label handling issues in button components and improves accessibility for pending state controllers. The changes ensure that aria-labels are properly managed and preserved across component state changes, providing better screen reader support.
Key Changes:
Button Component (@spectrum-web-components/button):
PendingState Controller (@spectrum-web-components/reactive-controllers):
Motivation and context
The previous implementation had timing issues, allowing aria-label updates to occur before slot content changes were fully processed, leading to inconsistent accessibility behavior. Additionally, the pending state controller was using
aria-valuetext
instead ofaria-label
for progress indicators, which is not the recommended approach for accessibility.These changes ensure that:
Related issue(s)
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch
,minor
, ormajor
featuresManual review test cases
Device review