-
Notifications
You must be signed in to change notification settings - Fork 31
fix(InfoTip)!: Remove aria-live and implement focus mgmt #3215
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
|
View your CI Pipeline Execution ↗ for commit a880b53 ☁️ Nx Cloud last updated this comment at |
LinKCoding
left a comment
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.
Overall, looks great!
It's much cleaner than the delayed announcement and the duplicate screenreader text.
Works great in VO and the focus control is 🔥
Left some nits, but not blocking and up to you if you'd want to implement.
|
|
||
| ## Custom Accessible Labeling | ||
|
|
||
| Provide either `ariaLabel` or `ariaLabelledby` to ensure screen reader users understand the purpose of the InfoTip button. |
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.
Note: the phrasing here is stronger than the current JSDoc:
Its recommended to provide either
ariaLabelorariaLabelledby.
where "recommended" to me feels a bit more optional.
| export type InfoTipProps = TipBaseProps & { | ||
| alignment?: TipBaseAlignment; | ||
| /** | ||
| * Accessible label for the InfoTip button. Its recommended to provide either `ariaLabel` or `ariaLabelledby`. |
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: "Its" => "It's"
Also nit: Feels appropriate to remove "recommended", but would defer to an a11y expert if there's any opinion there.
| */ | ||
| ariaLabel?: string; | ||
| /** | ||
| * ID of an element that labels the InfoTip button. Its recommended to provide either `ariaLabel` or `ariaLabelledby`. |
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: "Its" => "It's"
Co-authored-by: Kenny Lin <[email protected]>
Co-authored-by: Kenny Lin <[email protected]>
LinKCoding
left a comment
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.
Looks great!
Left a quick note for your consideration~
| export type InfoTipPropsWithoutAria = Omit< | ||
| InfoTipProps, | ||
| 'ariaLabel' | 'ariaLabelledby' | ||
| > & { |
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.
This Omit makes me think that InfoTipPropsWithAriaLabel and InfoTipPropsWithAriaLabelledby can share an InfoTipsBaseProps (that get exported and used here)
and then the aria-* specific props be part of a discriminated union.
Food for thought :)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3215 +/- ##
==========================================
- Coverage 89.65% 89.04% -0.62%
==========================================
Files 353 236 -117
Lines 5065 4298 -767
Branches 1606 1446 -160
==========================================
- Hits 4541 3827 -714
+ Misses 516 463 -53
Partials 8 8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
LinKCoding
left a comment
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.
Looked over Radio, CheckBox with InfoTip
and GridForm (which had a Radio with InfoTip)
and the VO announces the label now too! 🔥
|
📬 Published Alpha Packages: |
|
🚀 Styleguide deploy preview ready! Preview URL: https://697a6f997b82d6cc07952ec5--gamut-preview.netlify.app |
Overview
Adds props to InfoTip for customizing the button's
aria-labelandaria-labelledbyattribute. Also adds automatic focus management - when you open an InfoTip, focus moves to the content container. This removed aria-live since it's no longer needed.PR Checklist
Testing Instructions
Auto-focus + keyboard nav (verify tab order makes sense!):
Floating without links:
Defaultstory withplacement: "floating"Floating with links:
WithLinksOrButtonsstoryInline without links:
Defaultstory (default inline placement)Inline with links:
GridForm + ConnectedForm
Screen reader check:
Finish and do a celebratory dance 🎉
PR Links and Envs