Bug 269523 - AX: aria-hidden=true should be ignored on the body and html elements
Summary: AX: aria-hidden=true should be ignored on the body and html elements
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Tyler Wilcock
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-02-15 16:19 PST by Scott
Modified: 2024-04-18 08:57 PDT (History)
10 users (show)

See Also:


Attachments
Patch (11.98 KB, patch)
2024-04-12 17:45 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (11.98 KB, patch)
2024-04-17 11:42 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Scott 2024-02-15 16:19:19 PST
The ARIA spec is updating with a new requirement where user agents must ignore the aria-hidden=true attribute when used on the HTML or BODY element of a web page.

The specific text:

To prevent authors erroneously hiding entire window-rendered documents only to those using assistive technology, user agents MUST NOT expose the hidden state to assistive technologies if it is specified on the root element or the host language element that represents the contents of the primary document in view. For instance, the html or body elements in an HTML document, or the root svg element if it is rendered as its own primary document in the browser window. If authors were to specify aria-hidden="true" on the opening tag for an embedded document, for instance on a math or svg embedded within an HTML document, user agents would still be expected to hide these elements from assistive technologies.

A basic test case, such as, would result in no ignored elements, as the aria-hidden=true on the html element would be ignored.

<html lang=en aria-hidden=true>
  <h1>hello world</h1>
  <p>my content</p>
  <a href=#>a hyperlink</a>
</html>


ARIA PR 1880 - https://github.com/w3c/aria/pull/1880
Comment 1 Radar WebKit Bug Importer 2024-02-15 16:19:33 PST
<rdar://problem/123049663>
Comment 2 Tyler Wilcock 2024-04-12 17:45:19 PDT
Created attachment 470908 [details]
Patch
Comment 3 chris fleizach 2024-04-14 06:22:58 PDT
Comment on attachment 470908 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=470908&action=review

> Source/WebCore/accessibility/AccessibilityObject.cpp:3995
> +    if (tag == bodyTag || tag == htmlTag || (tag == SVGNames::svgTag && !element->parentNode()))

Is frame and iframe still ok to hide?
Comment 4 chris fleizach 2024-04-14 06:23:54 PDT
Comment on attachment 470908 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=470908&action=review

> Source/WebCore/accessibility/AccessibilityObject.cpp:3995
> +    if (tag == bodyTag || tag == htmlTag || (tag == SVGNames::svgTag && !element->parentNode()))

Is frame and iframe still ok to hide?
Comment 5 Jonathan Bedard 2024-04-15 16:58:47 PDT
Pull request: https://github.com/WebKit/WebKit/pull/27294
Comment 6 Jonathan Bedard 2024-04-15 16:59:39 PDT
Sending through EWS as a PR so that we can avoid the patch application bug plaguing GTK and WPE ports, for the moment.
Comment 7 Jonathan Bedard 2024-04-16 07:45:47 PDT
Passed GTK and WPE tests in https://github.com/WebKit/WebKit/pull/27294, landing!
Comment 8 Tyler Wilcock 2024-04-17 11:42:24 PDT
Created attachment 470965 [details]
Patch
Comment 9 Tyler Wilcock 2024-04-18 07:58:14 PDT
(In reply to chris fleizach from comment #4)
> Comment on attachment 470908 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=470908&action=review
> 
> > Source/WebCore/accessibility/AccessibilityObject.cpp:3995
> > +    if (tag == bodyTag || tag == htmlTag || (tag == SVGNames::svgTag && !element->parentNode()))
> 
> Is frame and iframe still ok to hide?
It's possible we'll want to apply this heuristic to iframe and frame, but that would require more exploration (Are developers making this mistake on these elements too? Are there more legitimate use cases for aria-hidden on frame / iframe than body / html / root SVGs?)
Comment 10 EWS 2024-04-18 08:57:50 PDT
Committed 277677@main (873f5404e780): <https://commits.webkit.org/277677@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 470965 [details].