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

LibWeb: Ignore: “orphaned” ARIA roles, landmark roles which lack required names, role=none for focusable or has-global-ARIA-attribute elements #2972

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sideshowbarker
Copy link
Contributor

@sideshowbarker sideshowbarker commented Dec 19, 2024

This change includes six commits:

  • 02d1810 LibWeb: Ignore “orphaned” ARIA roles
  • fe2408c LibWeb: Ignore name-required landmark roles which lack accessible names
  • c8f4f7f LibWeb: Ignore role=none for focusable & has-global-ARIA-attribute cases
  • d1cbc22 LibWeb: Return true for is_focusable() elements with non-null tabindex
  • 42d1663 LibWeb: Allow accessible-name computation to skip role-attribute lookup
  • f571b7c LibWeb: Add a to_element function to ARIAMixin

@sideshowbarker sideshowbarker force-pushed the aria_handle_orphaned_roles branch from 5b20483 to 6175fe2 Compare December 19, 2024 14:43
@sideshowbarker sideshowbarker changed the title LibWeb: Ignore “orphaned” ARIA roles LibWeb: Ignore “orphaned” ARIA roles and ignore landmark roles which lack required names Dec 19, 2024
@sideshowbarker sideshowbarker force-pushed the aria_handle_orphaned_roles branch 5 times, most recently from 2106692 to 2ab1757 Compare December 20, 2024 09:08
@sideshowbarker sideshowbarker changed the title LibWeb: Ignore “orphaned” ARIA roles and ignore landmark roles which lack required names LibWeb: Ignore: “orphaned” ARIA roles, landmark roles which lack required names, role=none for focusable or has-global-ARIA-attribute elements Dec 20, 2024
Copy link

Your pull request has conflicts that need to be resolved before it can be reviewed and merged. Make sure to rebase your branch on top of the latest master.

@github-actions github-actions bot added the conflicts Pull request has merge conflicts that need resolution label Dec 20, 2024
This change adds a virtual to_element function to ARIAMixin, and
overrides it in DOM::Element so it can then be used back inside
ARIAMixin to get an element when needed (for example, when computing a
role requires checking the roles of ancestors of an element).
Per https://w3c.github.io/aria/#document-handling_author-errors_roles,
determining whether to ignore certain specified landmark roles requires
first determining whether the element for which the role is specified
has an accessible name.

But if we then try to retrieve a role for such elements, we end up
calling right back into the accessible-name computation code — which
would cause the calls to loop infinitely.

So to avoid that — and to have handling for any other future cases the
spec may introduce of such recursive calls that will loop indefinitely —
this change introduces a parameter that callers can pass to cause
role-attribute lookup to be skipped during accessible-name computation.
This change implements the requirements stated in the HTML spec at
https://html.spec.whatwg.org/multipage/interaction.html#tabindex-value
that UAs must allow HTML elements with non-null tabindex values to be
considered as focusable areas.
This change causes explicitly-specified role attributes to be ignored in
the case where the specified role is “orphaned” — that is, when its
element lacks a required ancestor with an appropriate role.
This change implements the role-checking requirement from the ARIA spec
at https://w3c.github.io/aria/#document-handling_author-errors_roles
that the"form" and "region" roles are required to have accessible names,
and that if they do not have accessible names as required, UAs must
treat them as if they’d not be specified at all.
This change causes explicit role=none and role=presentation attribute
values to be ignored in cases where the elements for which those values
are specified are either focusable, or have global ARIA attributes —
per https://w3c.github.io/aria/#conflict_resolution_presentation_none.
@sideshowbarker sideshowbarker force-pushed the aria_handle_orphaned_roles branch from 2ab1757 to c8f4f7f Compare December 21, 2024 00:09
@github-actions github-actions bot removed the conflicts Pull request has merge conflicts that need resolution label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant