Skip to content

Remove Summary a11y warning - #40165

Merged
dipikabh merged 2 commits into
mdn:mainfrom
leekeh:patch-1
Jul 23, 2025
Merged

Remove Summary a11y warning#40165
dipikabh merged 2 commits into
mdn:mainfrom
leekeh:patch-1

Conversation

@leekeh

@leekeh leekeh commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

Description

Remove outdated warning on accessibility roles in the <summary> element.

Motivation

The implicit role of the element was changed from button to no corresponding role in the aria specifications at the end of 2022:

Seems like the implicit role was corrected on mdn in 2023 (#28602), but this specific warning was forgotten.

Although the specifications still contain a warning that browsers will still use a button role, I tested this and found it to not be the case at least in Chromium, Firefox and Safari. So perhaps the specs also need to be updated.

Additional details

Related issues and pull requests

Relates to #28602

@leekeh
leekeh requested review from a team and dipikabh and removed request for a team July 1, 2025 21:22
@github-actions github-actions Bot added Content:HTML Hypertext Markup Language docs size/xs [PR only] 0-5 LoC changed labels Jul 1, 2025
@github-actions

github-actions Bot commented Jul 2, 2025

Copy link
Copy Markdown
Contributor

Preview URLs

(comment last updated: 2025-07-23 15:31:49)

@dipikabh dipikabh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@leekeh Thanks a lot for following up on that earlier PR.
Indeed, it got merged without an update to the warning message.

You mention you've tested the current behavior, but I think we should retain the warning for good measure.

Comment on lines -117 to -118
> [!WARNING]
> Because the `<summary>` element has a default role of [button](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/button_role) (which strips all roles from child elements), this example will not work for users of assistive technologies such as screen readers. The `<h4>` will have its role removed and thus will not be treated as a heading for these users.

@dipikabh dipikabh Jul 2, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would suggest updating it as proposed in #28602 (comment) (slightly edited):

> [!WARNING]
> The role assigned to the `<summary>` element varies across browsers. Some still assign it a default [`button`](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/button_role) role, which removes all roles from its children. This inconsistency can cause issues for users of assistive technologies such as screen readers (`<h4>` in the previous example will have its role removed and will not be treated as a heading for these users). You should test your `<summary>` implementation on multiple platforms to ensure there's consistent accessibility support.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm curious for which user agents this is still the case, is this still a concern?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't have an exhaustive list of how all the different combinations of browsers and assistive technologies are handling this. So I'd say it's worth keeping this cautionary note around, at least until the spec is updated as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@leekeh would you be able to come back to this PR soonish? Would be great to have this published.

@bsmth bsmth added the awaiting response Awaiting for author to address review/feedback label Jul 16, 2025
@dipikabh

Copy link
Copy Markdown
Contributor

Hi @leekeh, I've gone ahead and applied the edited warning text to keep things moving.
If you have any concerns or follow-ups, please feel free to comment here or open a new PR.

Thanks again for your contribution!!

@dipikabh
dipikabh merged commit ad6662d into mdn:main Jul 23, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting response Awaiting for author to address review/feedback Content:HTML Hypertext Markup Language docs size/xs [PR only] 0-5 LoC changed

4 participants