Repository: flutter
Issue: [go_router] Semantics disappearing in `ShellRoute`
Labels: framework,a: accessibility,package,has reproducible steps,P2,p: go_router,workaround available,team-framework,triaged-framework,found in release: 3.13,found in release: 3.15

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. create a new project and install go_router `flutter pub add go_router`.
2. Create a GoRouter configuration as seen in the attached code sample.
3. Create the Home widget and the ShellOne widget.
4. Enable `showSemanticsDebugger` in `MaterialApp`.
5. Run the code.

### Expected results

This sample app contains a `ShellRoute` with an internal `GoRoute`. 

The `GoRoute` displays the `Home` widget, which is just a `Placeholder` with a custom `Semantics` label "HOME".

The `ShellRoute` has a `Column` with a `Placeholder` at the top, with a height of 100 px, and a custom `Semantics` label of `SHELL ONE`.

When running the app, you can see the two Placeholders (screenshot 1)

One would also expect to see the two Semantics labels, the `SHELL ONE` and the `HOME`.


### Actual results

However, the semantics label of the `ShellOne` Widget is gone, and only the semantics of the `Home` widget is visible.

See screenshot 2.

This causes that, for example, a navigation bar in a `ShellRoute` doesn't show semantics, which affects both user accessibility and also integration testing based off accessibility labels (e.g. Maestro).

My only guess is that `ShellRoute` injects a `BlockSemantics` as part of the widget builder, which wraps the original child in a `Navigator`, as it can be seen in the Widget inspector tree:

See screenshot 3.

### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      title: 'Flutter Demo',
      showSemanticsDebugger: true,
      routerConfig: GoRouter(routes: [
        ShellRoute(
          builder: (context, state, child) => ShellOne(child: child),
          routes: [
            GoRoute(
              path: '/',
              builder: (context, state) => const Home(),
            )
          ],
        )
      ]),
    );
  }
}

class Home extends StatelessWidget {
  const Home({super.key});

  @override
  Widget build(BuildContext context) {
    return Semantics(
      label: 'HOME',
      child: const Placeholder(),
    );
  }
}

class ShellOne extends StatelessWidget {
  const ShellOne({
    super.key,
    required this.child,
  });

  final Widget child;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Semantics(
          label: 'SHELL ONE',
          child: const SizedBox(
            height: 100,
            child: Placeholder(),
          ),
        ),
        Expanded(child: child),
      ],
    );
  }
}
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

![Screenshot from 2023-09-28 10-14-48](https://github.com/flutter/flutter/assets/2494376/7a541e45-c67b-4a7b-874f-ad0ebf625481)

![Screenshot from 2023-09-28 10-15-01](https://github.com/flutter/flutter/assets/2494376/b01a9b03-019d-4d2e-a26d-1211e8d275d1)

![image](https://github.com/flutter/flutter/assets/2494376/24e5a05e-5adc-4826-965a-a6927b3ac9c4)

</details>


### Logs

<details><summary>Logs</summary>

```console
Launching lib/main.dart on Linux in debug mode...
Building Linux application...

(go_router_nested_semantics:57586): Gdk-CRITICAL **: 10:47:31.418: gdk_window_get_state: assertion 'GDK_IS_WINDOW (window)' failed
Debug service listening on ws://127.0.0.1:43403/kvDz0Hm_Sus=/ws
Syncing files to device Linux...
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.13.5, on Ubuntu 22.04.3 LTS 6.2.0-33-generic, locale en_US.UTF-8)
    • Flutter version 3.13.5 on channel stable at /home/miquel/dev/tools/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 12fccda598 (9 days ago), 2023-09-19 13:56:11 -0700
    • Engine revision bd986c5ed2
    • Dart version 3.1.2
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /home/miquel/Android/Sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at:
      /home/miquel/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Homebrew clang version 15.0.5
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2022.2)
    • Android Studio at /home/miquel/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.10121639
    • 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.6+0-17.0.6b802.4-9586694)

[✓] Android Studio (version 2022.3)
    • Android Studio at /home/miquel/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996
    • 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.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Community Edition (version 2023.2)
    • IntelliJ at /home/miquel/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/232.9921.47
    • Flutter plugin version 75.1.4
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version unknown)
    • VS Code at /snap/code/current
    • Flutter extension version 3.70.0
    ✗ Unable to determine VS Code version.

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 22.04.3 LTS 6.2.0-33-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 116.0.5845.187

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>