Skip to content

Reapply "Add set semantics enabled API and wire iOS a11y bridge" #174163

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Aug 20, 2025

Previous pr is reverted due to internal test failure

This is a straight reland, no change from previous. only need to migrate internal code

fixes #158399

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.

@chunhtai chunhtai requested a review from a team as a code owner August 20, 2025 21:01
@github-actions github-actions bot added platform-ios iOS applications specifically framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine repository. See also e: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) platform-windows Building on or for Windows specifically platform-web Web applications specifically a: desktop Running on desktop team-ios Owned by iOS platform team labels Aug 20, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new API, PlatformDispatcher.setSemanticsTreeEnabled, to allow the framework to control when the semantics tree is generated and sent to the engine. This change refactors the semantics enabling logic, particularly for iOS, by moving the creation of the AccessibilityBridge to be controlled by this new API. The changes are well-tested with new unit and integration tests. My feedback is minor, focusing on a small documentation clarification to improve API clarity.

/// may dispose any resources associated with processing semantics as no further
/// semantics updates will be sent via [FlutterView.updateSemantics].
///
/// One must call this method with true before sending update through [updateSemantics].
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The documentation for setSemanticsTreeEnabled refers to [updateSemantics]. This is ambiguous as it could refer to the deprecated PlatformDispatcher.updateSemantics or FlutterView.updateSemantics. To improve clarity and guide developers to the correct API, it would be better to explicitly mention [FlutterView.updateSemantics].

  /// One must call this method with true before sending update through [FlutterView.updateSemantics].

@chunhtai chunhtai force-pushed the issues/158399-reland branch from 24bc279 to c7e0c54 Compare August 21, 2025 17:27
@chunhtai chunhtai force-pushed the issues/158399-reland branch from c7e0c54 to 00788e2 Compare August 21, 2025 21:08
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) a: desktop Running on desktop engine flutter/engine repository. See also e: labels. framework flutter/packages/flutter repository. See also f: labels. platform-ios iOS applications specifically platform-web Web applications specifically platform-windows Building on or for Windows specifically team-ios Owned by iOS platform team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SemanticsBinding.instance.ensureSemantics causes inconsistent state for mobile
2 participants