Skip to content

[A11y][Web] Support isAccessibilityFocusBlocked flag on web - #182789

Closed
hannah-hyj wants to merge 2 commits into
flutter:masterfrom
hannah-hyj:AccessibilityFocusBlockType-web
Closed

hannah-hyj wants to merge 2 commits into
flutter:masterfrom
hannah-hyj:AccessibilityFocusBlockType-web

Conversation

@hannah-hyj

@hannah-hyj hannah-hyj commented Feb 23, 2026 •

Copy link
Copy Markdown
Member

... using aria-hidden.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) platform-web Web applications specifically labels Feb 23, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

The pull request correctly implements support for the isAccessibilityFocusBlocked flag on the web platform by mapping it to the aria-hidden attribute in the SemanticRole base class. This ensures that nodes and their descendants are properly hidden from the accessibility tree when requested. The implementation follows existing patterns in the web engine and includes a relevant test case. However, please ensure that the PR description and pre-launch checklist are fully completed as required by the repository's contribution guidelines.

…cs.dart

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@hannah-hyj
hannah-hyj requested a review from chunhtai February 24, 2026 18:45

if (semanticsObject.isFlagsDirty) {
if (semanticsObject.flags.isAccessibilityFocusBlocked) {
setAttribute('aria-hidden', 'true');

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.

this will hide the entire subtree, not just this node. If this is set by AccessibilityFocusBlockType.blockNode this will be broken i believe

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.

Good point, @chunhtai.

Also, a few things stand out from the aria-hidden docs:

Warning: Do not use aria-hidden="true" on focusable elements.

They don't explain why, but this warning is highlighted in red to indicate it's important. For focusable nodes, it could be better to use the disabled or inert attribute.

Using aria-hidden="false" will not re-expose the element to assistive technology if any of its parents specify aria-hidden="true".

Once aria-hidden: true is set, there's no way to unhide the children.

@hannah-hyj hannah-hyj Mar 12, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Warning: Do not use aria-hidden="true" on focusable elements.

My understanding is a focusable element should not be a11y unfocusable. We have the same check in the framework side, A semantics node should not be focusable and a11y unfocusable , but it can be unfocusable but a11y focusable. So it's wont be a problem.

Once aria-hidden: true is set, there's no way to unhide the children.

That's unfortunate. on the framework side we block a11y focus on node or subtree. I think we should either 1. annotate on the framework side that web only support block a11y focus for a subtree, blocking a node will block its children too or 2. just don't support block a11y focus on web. using the old way (dropping semantics nodes from the tree) in framework instead.

I prefer option 1 on this as blocking a subtree is the more common use case and the function to block a subtree is enough to replace BlockSemantics.

This is the design doc for isAccessibilityFocusBlocked to replace BlockSemantics: https://docs.google.com/document/d/1niJnShCR3-PIMYo1a9lWdVySBqr_wmXYPvBXntvcc0c/edit?tab=t.0

@chunhtai
chunhtai requested a review from mdebbar February 24, 2026 19:55
@chunhtai
chunhtai marked this pull request as draft March 11, 2026 21:42
@Piinks

Piinks commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Hey @hannah-hyj! Is this still something we want to land?

@hannah-hyj

Copy link
Copy Markdown
Member Author

Closing this PR as I don't have immediate plan to land it.

@hannah-hyj hannah-hyj closed this Jun 4, 2026
@marwfair

Copy link
Copy Markdown

Any plans on getting back to this, or should a new issue be opened?

@marwfair

Copy link
Copy Markdown

I created a new issue for this: #191484

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) engine flutter/engine related. See also e: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants