Repository: flutter
Issue: Web Accessibility: When screen reader is turned ON, accessibility focus is lost after navigating to detail screen
Labels: framework,a: accessibility,f: routes,platform-web,has reproducible steps,P2,found in release: 3.7,found in release: 3.9,team-web,triaged-web

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Execute `flutter run` on the code sample
2. Turn on Voiceover on macOS
3. Navigate to the `Go to detail screen` button using voiceover commands
4. Click on the button and then the user is navigated to the detail screen and hence the focus is lost.

**Expected results:** Focus should either come on the text in AppBar or the text displayed on the screen
**Actual results:** When the screen reader is turned ON, the screen reader focus is lost after navigating to the detail screen and the user has to go out of the web area and then get back again to get focus

<details>
<summary>Code sample</summary>

```dart
/// main.dart
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

import 'detail_screen.dart';

void main() {
  runApp(const MyApp());

  /// Enable Accessibility by default on Web
  RendererBinding.instance.setSemanticsEnabled(true);
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    const appTitle = 'Web Screen Reader Issue Demo';

    return MaterialApp(
      title: appTitle,
      home: Scaffold(
        appBar: AppBar(
          title: const Text(appTitle),
        ),
        // body: const MyCustomForm(),
        body: const MyHomePage(title: 'Semantics Demo'),
      ),
      routes: {
        '/detail-screen': (context) => const MyDetailScreen(),
      },
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          /// Side Menu
          Padding(
            padding: const EdgeInsets.all(20),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                const SizedBox(height: 20),
                const SizedBox(
                  height: 50,
                  child: Text(
                    'Side Menu',
                    style: TextStyle(fontSize: 18),
                  ),
                ),
                SizedBox(
                  height: 50,
                  child: InkWell(
                    child: const Text('Home Screen'),
                    onTap: () {},
                  ),
                ),
                SizedBox(
                  height: 50,
                  child: InkWell(
                    child: const Text('Products'),
                    onTap: () {},
                  ),
                ),
                SizedBox(
                  height: 50,
                  child: InkWell(
                    child: const Text('Home Screen'),
                    onTap: () {},
                  ),
                ),
                SizedBox(
                  height: 50,
                  child: InkWell(
                    child: const Text('Categories'),
                    onTap: () {},
                  ),
                ),
                SizedBox(
                  height: 50,
                  child: InkWell(
                    child: const Text('Cart'),
                    onTap: () {},
                  ),
                ),
              ],
            ),
          ),

          /// Navigate to another (child) screen
          Expanded(
            child: Padding(
              padding: const EdgeInsets.symmetric(vertical: 30),
              child: Column(
                children: [
                  const Text(
                    'Navigate to detail screen',
                    style: TextStyle(
                      fontSize: 20,
                      fontWeight: FontWeight.w700,
                    ),
                  ),
                  const Text(
                    "When screen readers are activated and user tries to navigate to it's detail screen or it's child screen, the focus doesn't come on screen",
                  ),
                  const SizedBox(height: 20),
                  ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).pushNamed(
                        MyDetailScreen.routerName,
                      );
                    },
                    child: const Text('Go to detail screen'),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}

```

```dart
/// detail_screen.dart
import 'package:flutter/material.dart';

class MyDetailScreen extends StatelessWidget {
  static const routerName = '/detail-screen';

  const MyDetailScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Detail screen'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            const Text('I am detail screen'),
            const SizedBox(height: 50),
            ElevatedButton(
              onPressed: () {
                Navigator.of(context).pop();
              },
              child: const Text('Go back to Parent screen'),
            ),
          ],
        ),
      ),
    );
  }
}

```

</details>

<details>
  <summary>Logs</summary>


<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel stable, 3.7.5, on macOS 13.2.1 22D68 darwin-x64, locale
    en-IN)
    • Flutter version 3.7.5 on channel stable at
      /Volumes/data/development/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c07f788888 (3 weeks ago), 2023-02-22 17:52:33 -0600
    • Engine revision 0f359063c4
    • Dart version 2.19.2
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version
    33.0.0-rc1)
    • Android SDK at /Users/akashav/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0-rc1
    • ANDROID_HOME = /Users/akashav/Library/Android/sdk
    • Java binary at:
      /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/jav
      a
    • Java version OpenJDK Runtime Environment (AdoptOpenJDK)(build
      1.8.0_292-b10)

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.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
    • Try updating or re-installing Android Studio.

[✓] VS Code (version 1.76.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.60.0

[✓] Connected device (3 available)
    • RMX3031 (mobile) • GQBQLJ4XNRJNN7KJ • android-arm64  • Android 11 (API 30)
    • macOS (desktop)  • macos            • darwin-x64     • macOS 13.2.1 22D68 darwin-x64
    • Chrome (web)     • chrome           • web-javascript • Google Chrome 111.0.5563.64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

[✓] No issues found!
```

</details>


<!--
      Consider also attaching screenshots and/or videos to better
      illustrate the issue.

      You can upload them directly on GitHub.
      Beware that video file size is limited to 10MB.
-->


https://user-images.githubusercontent.com/97581635/225892389-d7135d76-466f-4135-b5bb-9250bc823c7d.mov