-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Ventura dialog semantics workaround #17148
Conversation
() => | ||
__DARWIN__ && | ||
systemVersionGreaterThanOrEqualTo('13.0') && | ||
systemVersionLessThan('14.0') |
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 could have just said >= 13.. but I am kind of hoping with sadistic optimism that Apple will correct this in a later version and we can use correct semantics again.. but if they don't, another bug report may arise leading to this needing to be extended to include later versions.
* `aria-labelledby` where both ids are announced. | ||
* | ||
*/ | ||
private getAriaAttributes() { |
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.
Another option as seen in #17134 would be to set the aria-label
attribute to the contents of the props.title
. This would be better semantically, but, sometimes that title is not a string and therefore using aria-describedby
allows us to still point to the id of the title for both strings and JSX.elements. Additionally, the below has less hairy code.
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 workaround!! The implementation makes total sense and as far as I've tested on macOS and Windows, it works as in the videos. I only have one question about one line, so I'm gonna approve it and let you decide what to do about it 😄
Great work! 💖
|
||
if (this.props.role === 'alertdialog') { | ||
return { | ||
'aria-labelledby': `${this.state.titleId} ${this.props.ariaDescribedBy}`, |
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.
Don't we need to ?? ''
the this.props.ariaDescribedBy
as in line 760? 🤔
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 props of the dialog are such that if the role=alertdialog
than the ariaDescribedBy
prop is required.. It should always be populated in this case. Tho, I think typescript probably sees it as possibly undefined, and also if somehow this was provided as undefined (like at runtime), the worst case is it prints "undefined" which just doesn't do anything.
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 props of the dialog are such that if the
role=alertdialog
than theariaDescribedBy
prop is required.. It should always be populated in this case. Tho, I think typescript probably sees it as possibly undefined, and also if somehow this was provided as undefined (like at runtime), the worst case is it prints "undefined" which just doesn't do anything.
xref: https://github.com/github/accessibility-audits/issues/4979
Description
This PR is targeted workaround for macOS Ventura which introduced a regression in announcing dialog titles and descriptions.
For role of
dialog
(default), thearia-labelledby
is not announced and if provided prevents thearia-describedby
from being announced. Thus, in this case, we will add thearia-labelledby
to thearia-describedby
.For role of
alertdialog
, thearia-labelledby
is announced but not thearia-describedby
. Thus, in this case, we will add both to thearia-labelledby
For windows, we maintain correct semantics in that the dialog element should have
aria-labelledby
and thearia-describedby
is optional unless the dialog has a role ofalertdialog
, in which case both are required.A known caveat:
aria-describedby
as "{aria-labelledby-id aria-describedby-id}". macOS only reads the first one and mentions the existence of "other things". It is unknown whether that was expected behavior before the regression. We do not currently have any non alert dialogs with a description and therefore this does not impact us.Screenshots
macOS Ventura
CleanShot.2023-07-31.at.08.20.46.mp4
windows
CleanShot.2023-07-31.at.08.16.18.mp4
Release notes
Notes: [Fixed] Adds a workaround for the macOS Ventura
aria-labelledby
andaria-describedby
regressions such that dialog titles are always announced.