Content-Length: 331189 | pFad | https://github.com/desktop/desktop/issues/17148

02 Ventura dialog semantics workaround by tidy-dev · Pull Request #17148 · desktop/desktop · GitHub
Skip to content
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

Merged
merged 4 commits into from
Aug 1, 2023
Merged

Conversation

tidy-dev
Copy link
Contributor

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), the aria-labelledby is not announced and if provided prevents the aria-describedby from being announced. Thus, in this case, we will add the aria-labelledby to the aria-describedby.

For role of alertdialog, the aria-labelledby is announced but not the aria-describedby. Thus, in this case, we will add both to the aria-labelledby

For windows, we maintain correct semantics in that the dialog element should have aria-labelledby and the aria-describedby is optional unless the dialog has a role of alertdialog, in which case both are required.

A known caveat:

  • For a non alert dialog, we use form the 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 and aria-describedby regressions such that dialog titles are always announced.

() =>
__DARWIN__ &&
systemVersionGreaterThanOrEqualTo('13.0') &&
systemVersionLessThan('14.0')
Copy link
Contributor Author

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() {
Copy link
Contributor Author

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.

Copy link
Member

@sergiou87 sergiou87 left a 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}`,
Copy link
Member

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? 🤔

Copy link
Contributor Author

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.

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.

@tidy-dev tidy-dev merged commit 7362c83 into development Aug 1, 2023
@tidy-dev tidy-dev deleted the venutura-dialog-semantics branch August 1, 2023 01:15
@tidy-dev tidy-dev added the accessibility Issues related to accessibility improvements label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility Issues related to accessibility improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/desktop/desktop/issues/17148

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy