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

Add aria-expanded to getAccessibilityTree and <details>/<summary> #451

Merged
merged 1 commit into from Mar 31, 2022

Conversation

calebeby
Copy link
Member

@calebeby calebeby commented Mar 31, 2022

Closes #347

Copy link
Member

@spaceninja spaceninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

expect(await getAccessibilityTree(page)).toMatchInlineSnapshot(`
document
group
button "Click me! Tags in summary do not preserve their semantic meaning" (expanded=true) (focused)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior is according to spec (the <h1> inside of <summary> loses its semantic meaning). But, the behavior does not match voiceover in safari, or chrome or firefox's accessibility tree.

According to the spec:

It would be more difficult for us to diverge from the spec and implement it the way browsers do. Chrome accessibility tree, firefox accessibility tree, and safari voiceover all chose not to use the button role for <summary> elements. We could add a special override here but I would rather not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are what browsers use for <summary> elements:

  • Chrome devtools accessibility tree: DisclosureTriangle
  • Firefox devtools accessibility tree: summary
  • Safari VO: summary, group

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's reasonable to leave this matching the spec. Might be good to add a "known issues" section in the README, though, outlining things like this that might otherwise trigger bug reports.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

I would be open to people opening issues for their use cases where they run into this difference, where we can continue the conversation of whether it makes sense to match the spec here

@calebeby calebeby changed the title Add aria-expanded support to getAccessibilityTree and fix handling for <details>/<summary> Add aria-expanded to getAccessibilityTree and <details>/<summary> Mar 31, 2022
@calebeby calebeby merged commit eb364cc into main Mar 31, 2022
@calebeby calebeby deleted the getAccessibilityTree-expanded branch March 31, 2022 20:45
@github-actions github-actions bot mentioned this pull request Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add aria-expanded to getAccessibilityTree
2 participants