Skip to content

Add set semantics enabled API and wire iOS a11y bridge#161265

Merged
auto-submit[bot] merged 7 commits intoflutter:masterfrom
chunhtai:issues/158399-r3
Mar 24, 2025
Merged

Add set semantics enabled API and wire iOS a11y bridge#161265
auto-submit[bot] merged 7 commits intoflutter:masterfrom
chunhtai:issues/158399-r3

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Jan 7, 2025

fixes #158399

old pr flutter/engine#56691

previously the only correct way to enable semantics is that ios embedding receive signal from native OS, it call SetSemanticsEnabled to shell and then to dart to enable semantics tree generation.

If for some reason framework decide to enable semantics first, e.g. through SemanticsBinding.instance.ensureSemantics(typically due to integration test or ci that wants to test semantics), the update will be dropped in shell. Even if it later on receive signal from native OS to turn on semantics, it can't construct the complete accessibility tree in embedding because the updatesemantics sends diff update and previous updates are gone forever. It will end up in a broken state.

This pr changes so that the only source of truth will be in the framework side. When framework starts generating the the semantics tree, it will call SetSemanticsTreeEnabled through dart:ui, and the embedding needs to prepare itself to accept semantics update after receiving the message.

This however require some refactoring on iOS embedding because it will only create a11y bridge when receiving OS notification when assitive technologies turns on.

This requires three phase transition

add an empty dart:ui API setSemanticsTreeEnabled
makes framework calls the empty API.
merge this pr with actual implementation of setSemanticsTreeEnabled

I will do the android part in a separate pr

Pre-launch Checklist

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

@github-actions github-actions bot added platform-ios iOS applications specifically framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine related. See also e: labels. platform-web Web applications specifically labels Jan 7, 2025
@github-actions github-actions bot added the a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) label Jan 8, 2025
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

@chunhtai can you add a PR description with the rationale for the change, related bug(s), etc.?

@chunhtai
Copy link
Contributor Author

@chunhtai can you add a PR description with the rationale for the change, related bug(s), etc.?

sorry, forgot to add description. Done

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM for dart:ui (after doc nits are resolved)

/// Informs the engine whether the framework is generating a semantics tree.
///
/// Only framework knows when semantics tree should be generated. It uses this
/// method to notify the engine such event.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe better:

Suggested change
/// method to notify the engine such event.
/// method to notify the engine whether the framework will generate a semantics tree.

@chunhtai chunhtai force-pushed the issues/158399-r3 branch 2 times, most recently from 0346c47 to 4428901 Compare February 14, 2025 20:42
@justinmc
Copy link
Contributor

@chunhtai heads up there are failures here if you hadn't seen.

@chunhtai chunhtai force-pushed the issues/158399-r3 branch 2 times, most recently from b3d00a8 to 0fee10f Compare March 17, 2025 21:48
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

Just a few small nits then good to go!

@chunhtai chunhtai requested a review from cbracken March 18, 2025 20:56
Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

LGTM stamp from a Japanese personal seal

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 18, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 18, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Mar 18, 2025

autosubmit label was removed for flutter/flutter/161265, because - The status or check suite Mac_arm64 module_test_ios has failed. Please fix the issues identified (or deflake) before re-applying this label.

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 18, 2025
@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 24, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Mar 24, 2025
Merged via the queue into flutter:master with commit 26037df Mar 24, 2025
173 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 24, 2025
chunhtai added a commit to chunhtai/flutter that referenced this pull request Mar 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 25, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 27, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2025
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 related. 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SemanticsBinding.instance.ensureSemantics causes inconsistent state for mobile

4 participants