Repository: flutter
Issue: Semantics inside RawAutocomplete are displayed behind other UI elements
Labels: framework,a: accessibility,has reproducible steps,P2,found in release: 3.24,team-accessibility,triaged-accessibility,found in release: 3.27

### Steps to reproduce

1. Create an AutoComplete widget with a few items
2. Place that widget as a sibling in a column of other widgets
3. Enter Talkback on iOS
4. Run the app
5. Select the RawAutoComplete field
6. Start typing
7. Click on an option to select it

### Expected results

The dropdown option displayed in the interface should be selected

### Actual results

The UI content under the dropdown is selected

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  // Auto-enable accessibility for our Blind and Low Vision customers (see
  // https://docs.flutter.dev/development/accessibility-and-localization/accessibility#screen-readers).
  RendererBinding.instance.ensureSemantics();

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, required this.title});

  final String title;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      drawer: SafeArea(
        child: Container(
          width: 350,
          decoration: const BoxDecoration(color: Colors.white),
          child: CustomScrollView(
            slivers: [
              SliverList.list(
                  children: List.filled(
                5,
                const ExpansionTile(title: Text("TESTTILE")),
              ))
            ],
          ),
        ),
      ),
      body: CustomScrollView(
        slivers: [
          SliverList.list(
            children: (List.filled(
                  5,
                  const ExpansionTile(title: Text("TESTTILE")) as Widget,
                )) +
                [const AutocompleteDemo()] +
                List.filled(
                  5,
                  const ExpansionTile(title: Text("TESTTILE")) as Widget,
                ),
          )
        ],
      ),
      // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

class AutocompleteDemo extends StatelessWidget {
  const AutocompleteDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Autocomplete<String>(
      optionsBuilder: (TextEditingValue textEditingValue) {
        return const <String>["One", "Two", "Three", "Four", "Five"];
      },
      fieldViewBuilder:
          (context, textEditingController, focusNode, onFieldSubmitted) =>
              TextField(
        controller: textEditingController,
        focusNode: focusNode,
        onSubmitted: (_) => onFieldSubmitted(),
        decoration: const InputDecoration(
          border: OutlineInputBorder(),
          hintText: 'Type something',
        ),
      ),
      optionsViewBuilder: (context, onSelected, options) => Material(
        elevation: 4.0,
        child: ListView(
          children: options
              .map((String option) => ListTile(
                    title: Text(option),
                    onTap: () {
                      onSelected(option);
                    },
                  ))
              .toList(),
        ),
      ),
      onSelected: (String selection) {
        print('You just selected $selection');
      },
    );
  }
}

class RawAutocompleteDemo extends StatelessWidget {
  const RawAutocompleteDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return RawAutocomplete<String>(
      optionsBuilder: (TextEditingValue textEditingValue) {
        return const <String>["One", "Two", "Three", "Four", "Five"];
      },
      fieldViewBuilder:
          (context, textEditingController, focusNode, onFieldSubmitted) =>
              TextField(
        controller: textEditingController,
        focusNode: focusNode,
        onSubmitted: (_) => onFieldSubmitted(),
        decoration: const InputDecoration(
          border: OutlineInputBorder(),
          hintText: 'Type something',
        ),
      ),
      optionsViewBuilder: (context, onSelected, options) => Material(
        elevation: 4.0,
        child: ListView(
          children: options
              .map((String option) => ListTile(
                    title: Text(option),
                    onTap: () {
                      onSelected(option);
                    },
                  ))
              .toList(),
        ),
      ),
      onSelected: (String selection) {
        print('You just selected $selection');
      },
    );
  }
}


```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

In this video, the only time I swipe forwards is to scroll the view to the bottom.
All other moments, I am tapping the screen directly to try to select the menu items

https://github.com/user-attachments/assets/643c893e-dec1-49e1-9d9a-90cceb81ea17


The next images are the same screen, one with the semantics debugger, from the test code above:
![DF878BC6-A675-414D-B8B6-156DDCBD8A0D_4_5005_c](https://github.com/user-attachments/assets/9a86179d-030d-483a-a843-70f136a50d9c)
![B4476148-1327-437A-8122-711533E7524C_4_5005_c](https://github.com/user-attachments/assets/c8b56009-81a4-424f-8d85-e9dbaba58e8f)

The next images are from our production app with the same idea. You can see here that the dropdown semantics are still there, they are just being placed below in the tree:
![5A5A1A32-AA2F-4C29-AF4C-ABFB1E41CCB0_1_105_c](https://github.com/user-attachments/assets/4642459c-ab84-4fc4-b7e1-20476b3bf18e)
![A195D4E4-BE13-48C4-A533-28A078345096_1_105_c](https://github.com/user-attachments/assets/910a8052-356e-4d09-8074-e29adb859bc8)



</details>


### Logs

<details open><summary>Logs</summary>

```console
Launching lib/main.dart on Edward’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: MZ7437V6KU
Xcode build done.                                           16.3s
You may be prompted to give access to control Xcode. Flutter uses Xcode to run your app. If access is not allowed, you can change this through your Settings > Privacy & Security > Automation.
Connecting to VM Service at ws://127.0.0.1:51287/DPnMhMGurwc=/ws
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

Note - I have overriden Android studio so I can use the correct version of java.

```console
➜ flutter doctor
Doctor summary (to see all details, run flutter
doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0
    24A335 darwin-arm64, locale en-NZ)
[!] Android toolchain - develop for Android devices
    (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install
      "cmdline-tools;latest"`
      See
      https://developer.android.com/studio/command-li
      ne for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to
      accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup
      for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[!] Android Studio (version unknown)
    ✗ Unable to determine Android Studio version.
    ✗ android-studio-dir = /
    ✗ Android Studio not found at /Contents
[✓] VS Code (version 1.95.0)
[✓] Connected device (4 available)            
[✓] Network resources

! Doctor found issues in 2 categories.
```

</details>