mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[web] Enable semantics via query parameter for automation testing
This commit is contained in:
parent
acdca87356
commit
cf1a65abbc
@ -48,6 +48,19 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher {
|
||||
/// and ensures proper focus is set, enabling Flutter's focus restoration to work correctly
|
||||
/// when users navigate between pages.
|
||||
_addNavigationFocusHandler();
|
||||
|
||||
/// Check for query parameter to enable semantics programmatically after initialization.
|
||||
/// This must be done asynchronously to avoid circular dependency during construction.
|
||||
scheduleMicrotask(_checkQueryParameterForSemantics);
|
||||
}
|
||||
|
||||
/// Check for query parameter to enable semantics programmatically.
|
||||
/// This allows automation testing tools to enable semantics without modifying the app.
|
||||
/// Usage: https://example.com/?flutter-semantics
|
||||
void _checkQueryParameterForSemantics() {
|
||||
if (Uri.base.queryParameters.containsKey('flutter-semantics')) {
|
||||
EngineSemantics.instance.semanticsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
late StreamSubscription<int> _onViewDisposedListener;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user