-
Notifications
You must be signed in to change notification settings - Fork 30.4k
[Web][Engine] Update MediaQuery in response to semanticsEnabled #166836
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
Merged
auto-submit
merged 11 commits into
flutter:master
from
koji-1009:fix/accessible_navigation
Jun 2, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8646164
fix: Call invokeOnAccessibilityFeaturesChanged
koji-1009 9e447ab
test: onAccessibilityFeaturesChanged is executed when semantics is en…
koji-1009 a51f4c5
feat: Future.microtask
koji-1009 322d936
refactor: Avoid execution during build time
koji-1009 44d3b5b
test: Fix test cases
koji-1009 26f33c6
Merge branch 'master' into fix/accessible_navigation
koji-1009 1792c9f
refactor: Check schedulerPhase
koji-1009 1d70e07
Update packages/flutter/lib/src/semantics/binding.dart
koji-1009 4154822
Merge branch 'master' into fix/accessible_navigation
koji-1009 0be2b0e
Merge branch 'master' into fix/accessible_navigation
koji-1009 fea54cf
Update engine/src/flutter/lib/web_ui/test/engine/window_test.dart
koji-1009 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should do this in Widget MediaQuery, not all the listener here care about build phase.
Also when mediaQuery handles it, it should use postframecallback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think shuld all listeners be guarded from the build phase.
If we handle to do this on the MediaQuery side, we would call addPostFrameCallback in the
didChangeAccessibilityFeatures.https://github.com/flutter/flutter/blob/3.29.3/packages/flutter/lib/src/widgets/media_query.dart#L1905-L1914
didChangeAccessibilityFeaturesis public API, so app developers can use this. Therefore, all code that usesdidChangeAccessibilityFeatureswill need to be modified.https://api.flutter.dev/flutter/widgets/WidgetsBindingObserver/didChangeAccessibilityFeatures.html
If we do the build phase for listeners, there will be no breaking change to the public api. Since this breaking change affects only the web, it is difficult to notice and to understand why it is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will only happen if the ensureSemantics is called during build phase right? I think this is not a common use case. Now i think we may not even need to have this check. the correct fix will be move ensureSemantics to either a postframecallback or somewhere before runApp
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem occurred with the example code. I don't have that much experience with accessibility implementations, so let me ask: is calling the
ensureSemanticsmethod on a Button'sonTapa non-recommended implementation?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i see the issue now, this is mostly a web issue that it enable the semantics in updatesemantics instead of synchronously when ensureSemanitcs is called.
Can you convert the microtask here to check schedule phase and postframe callback, and add a todo to link to this issue #158399
That way we can clean it up later when i fix the web engine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll do it. Thanks for the review.