[web] Enable semantics via query parameter for automation testing
diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/platform_dispatcher.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/platform_dispatcher.dart
index c868219..d54dc89 100644
--- a/engine/src/flutter/lib/web_ui/lib/src/engine/platform_dispatcher.dart
+++ b/engine/src/flutter/lib/web_ui/lib/src/engine/platform_dispatcher.dart
@@ -48,6 +48,19 @@
/// 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;