Repository: flutter
Issue: Accessibility Finder issue for the widgets that are just before NestedNavigator(Navigator) in web
Labels: framework,a: accessibility,f: routes,platform-web,P2,team-framework,triaged-framework

### Steps to reproduce

1. Add `SemanticsBinding.instance.ensureSemantics();` to the main function.
2. Inspect the below-given code snippet in Chrome(any web browser) for Accessibility.

### Expected results

1. The Widgets before using Navigator should be visible in the accessibility tree.

### Actual results

1. The Widgets before using Navigator are not visible in the accessibility tree.

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';

void main() {
  runApp(const MyApp());
  SemanticsBinding.instance.ensureSemantics();
}

class MyApp extends StatelessWidget {
  const MyApp({
    super.key,
  });
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: TestingAccessibility(),
    );
  }
}

class TestingAccessibility extends StatefulWidget {
  const TestingAccessibility({super.key});

  @override
  State<TestingAccessibility> createState() => _TestingAccesabilityState();
}

class _TestingAccesabilityState extends State<TestingAccessibility> {
  final GlobalKey<NavigatorState> navigationKey = GlobalKey<NavigatorState>();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: SafeArea(
            child: Row(
      mainAxisSize: MainAxisSize.min,
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: [
        Text("Some text in Left 1"),
        Padding(
          padding: EdgeInsets.all(8.0),
        ),
        Text("Some text in Left 2"),
        Expanded(
          child: Container(
              decoration:
                  BoxDecoration(border: Border.all(color: Colors.blueAccent)),
              child: NestedNavigator(
                navigationKey: navigationKey,
                initialRoute: '/',
                routes: {
                  // default route as '/' is necessary!
                  '/': (context) => Text("Some text in center")
                },
              )),
        ),
        Expanded(child: Text("Some text in Right")),
      ],
    )));
  }
}

class NestedNavigator extends StatelessWidget {
  final GlobalKey<NavigatorState> navigationKey;
  final String initialRoute;
  final Map<String, WidgetBuilder> routes;

  const NestedNavigator({
    super.key,
    required this.navigationKey,
    required this.initialRoute,
    required this.routes,
  });

  @override
  Widget build(BuildContext context) {
    return PopScope(
      child: Navigator(
        key: navigationKey,
        initialRoute: initialRoute,
        onGenerateRoute: (RouteSettings routeSettings) {
          WidgetBuilder builder = routes[routeSettings.name]!;
          if (routeSettings.name == "/") {
            return PageRouteBuilder(
              pageBuilder: (context, __, ___) => builder(context),
              settings: routeSettings,
            );
          } else {
            return MaterialPageRoute(
              builder: builder,
              settings: routeSettings,
            );
          }
        },
      ),
      onPopInvoked: (bool b) {
        if (navigationKey.currentState!.canPop()) {
          navigationKey.currentState!.pop();
        }
      },
    );
  }
}



```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

<img width="1440" alt="image" src="https://github.com/flutter/flutter/assets/51310067/950fd5b1-7d17-4ba0-85aa-9e406984cc3e">

</details>


### Logs

<details open><summary>Logs</summary>

```console
No Logs
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[!] Flutter (Channel [user-branch], 3.19.6, on macOS 14.5 23F79 darwin-arm64, locale en-IN)
    ! Flutter version 3.19.6 on channel [user-branch] at /Users/piyushanand/development/FlutterSDK/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision 54e66469a9 (2 months ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/piyushanand/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/piyushanand/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.90.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (5 available)
    • sdk gphone64 arm64 (mobile) • emulator-5556                        • android-arm64  • Android 13 (API 33) (emulator)
    • Piyush’s iPhone (mobile)    • 00008020-001C78690E80402E            • ios            • iOS 17.5.1 21F90
    • iPhone 15 Pro Max (mobile)  • E9C45BE5-1DF1-43F6-83F7-EA52F935226F • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)             • macos                                • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                • chrome                               • web-javascript • Google Chrome 126.0.6478.127
    ! Error: Browsing on the local area network for iPhone . Ensure the device is unlocked and attached with a cable or associated with the same local area network as
      this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```

</details>