Repository: flutter
Issue: MenuAnchor based menu with SubmenuButton children cannot be exited by keyboard traversal (works fine with MenuItemButton)
Labels: framework,f: material design,has reproducible steps,P2,team-design,triaged-design,found in release: 3.19,found in release: 3.22

### Steps to reproduce

1. Create a MenuAnchor-based menu with SubMenuItemButton as children
2. Set the `childFocusNode` property of the MenuAnchor and also set it on the `MenuAnchor`'s child
3. Open the menu and use the keyboard to traverse the menu tree
4. Try to exit the menu with the keyboard (direction) only


Using the `childFocusNode` of the menu anchor only works if the topmost menu item is a `MenuItemButton`. It does not work if it is a `SubMenuItemButton`.

### Expected results

You should be able to navigate out of the menu list with keyboard traversal just like with MenuItemButton.

### Actual results

The user is unable to exit the menu using keyboard traversal alone (without tab).

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;

  const MyHomePage({
    super.key,
    required this.title,
  });

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final menu1FocusNode = FocusNode();
  final menu2FocusNode = FocusNode();
  final menu1Controller = MenuController();
  final menu2Controller = MenuController();
  final menu1FirstChildFocusNode = FocusNode();
  final menu2FirstChildFocusNode = FocusNode();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            MenuAnchor(
              controller: menu1Controller,
              childFocusNode: menu1FocusNode,
              menuChildren: [
                SubmenuButton(
                  focusNode: menu1FirstChildFocusNode,
                  menuChildren: [
                    MenuItemButton(
                      leadingIcon:
                          Transform.flip(flipY: true, child: Icon(Icons.sort)),
                      child: Text('Asc'),
                      onPressed: () {},
                    ),
                    MenuItemButton(
                      leadingIcon: Icon(Icons.sort),
                      onPressed: () {},
                      child: Text('descending'),
                    ),
                  ],
                  child: Text('Name'),
                ),
                SubmenuButton(
                  menuChildren: [
                    MenuItemButton(
                      leadingIcon:
                          Transform.flip(flipY: true, child: Icon(Icons.sort)),
                      child: Text('Asc'),
                      onPressed: () {},
                    ),
                    MenuItemButton(
                      leadingIcon: Icon(Icons.sort),
                      onPressed: () {},
                      child: Text('descending'),
                    ),
                  ],
                  child: Text('Name'),
                ),
              ],
              child: IconButton(
                  focusNode: menu1FocusNode,
                  tooltip: 'Sort',
                  onPressed: () {
                    menu1Controller.open();
                    menu1FirstChildFocusNode.requestFocus();
                  },
                  icon: Icon(Icons.abc)),
            ),
            SizedBox(height: 50),
            MenuAnchor(
              controller: menu2Controller,
              childFocusNode: menu2FocusNode,
              menuChildren: [
                MenuItemButton(
                  focusNode: menu2FirstChildFocusNode,
                  leadingIcon:
                      Transform.flip(flipY: true, child: Icon(Icons.sort)),
                  child: Text('Asc'),
                  onPressed: () {},
                ),
                MenuItemButton(
                  leadingIcon:
                      Transform.flip(flipY: true, child: Icon(Icons.sort)),
                  child: Text('Asc'),
                  onPressed: () {},
                ),
              ],
              child: IconButton(
                  focusNode: menu2FocusNode,
                  tooltip: 'Sort',
                  onPressed: () {
                    menu2Controller.open();
                    menu2FirstChildFocusNode.requestFocus();
                  },
                  icon: Icon(Icons.ac_unit_sharp)),
            ),
          ],
        ),
      ),
    );
  }
}
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.4.1 23E224 darwin-arm64, locale en-NG)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.3.6)
[✓] VS Code (version 1.87.2)
[✓] Connected device (4 available)
[✓] Network resources

```

</details>