Repository: flutter
Issue: TextSpan with a TapGestureRecognizer doesn't receive focus like buttons
Labels: framework,f: focus,has reproducible steps,P2,customer: chalk (g3),team-framework,triaged-framework,found in release: 3.16,found in release: 3.17

Internal: b/374884303

### 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. Run the code sample on web
2. Tap on "First Button", "world" and "Second Button" to verify that they are active buttons (each of them should print something to the console)
3. Repeatedly press on the keyboard's tab key and inspect the focus changes between the elements on screen.

### Expected results

The focus should move between "First Button", "world" and "Second Button"

### Actual results

The focus moves only between "First Button" and "Second Button". I suggested to test it on web for simplicity, but the issue exists on iOS and Android too when you use a physical keyboard connected to the device/simulator.

### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

class MainScreen extends StatelessWidget {
  const MainScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            TextButton(
              onPressed: () {
                print('First Button');
              },
              child: const Text('First Button'),
            ),
            Text.rich(
              TextSpan(
                children: [
                  const TextSpan(text: 'Hello '),
                  TextSpan(
                    text: 'world',
                    style: const TextStyle(
                      color: Colors.blue,
                      fontWeight: FontWeight.bold,
                      decoration: TextDecoration.underline,
                    ),
                    recognizer: TapGestureRecognizer()
                      ..onTap = () => print('Hello world'),
                  ),
                ],
              ),
            ),
            TextButton(
              onPressed: () {
                print('Second Button');
              },
              child: const Text('Second Button'),
            ),
          ],
        ),
      ),
    );
  }
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MainScreen(),
    );
  }
}

void main() {
  runApp(const MainApp());
}
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>


https://github.com/flutter/flutter/assets/42715466/ab21b625-7d41-4c71-905e-6dfa29e9ebd9



</details>


### Logs

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


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.13.4, on macOS 13.3 22E252 darwin-arm64, locale en-IL)
    • Flutter version 3.13.4 on channel stable at /Users/liran/code/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 367f9ea16b (10 weeks ago), 2023-09-12 23:27:53 -0500
    • Engine revision 9064459a8b
    • Dart version 3.1.2
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/liran/Library/Android/sdk
    • Platform android-34, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.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 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.84.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.76.0

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile)         • emulator-5554                        • android-arm64  • Android 14 (API 34) (emulator)
    • iPhone SE (3rd generation) (mobile) • CA0C2BE5-F68A-4D63-AA8B-B5E82D27F38C • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)                     • macos                                • darwin-arm64   • macOS 13.3 22E252 darwin-arm64
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 119.0.6045.159

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>