Repository: flutter
Issue: TAB key skips non-visible rows of ListView.builder when entering into ListView AND has trouble with leaving from last line
Labels: framework,a: accessibility,f: scrolling,a: desktop,has reproducible steps,P2,found in release: 3.10,found in release: 3.11,team-framework,triaged-framework

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

<!-- You must include full steps to reproduce so that we can reproduce the problem. -->

1. Run `flutter create bug`.
2. Update the files as follows: 

<details>
<summary>main.dart</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  static const ROW_COUNT = 10;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
        // I use ElevatedButton in this bug demo because it shows focus more
        // clear than TextButton.
        leading: ElevatedButton(
          onPressed: () {},
          child: Icon(Icons.bug_report, color: Colors.white),
        ),
      ),
      body: Center(
        child: ListView.builder(
          itemCount: ROW_COUNT,
          itemBuilder: (context, index) => index < ROW_COUNT
              ? ListTile(
                  title: Text('row ${index + 1}'),
                  leading: ElevatedButton(child: Icon(Icons.bug_report), onPressed: () {
                    print('Row ${index + 1}');
                  },),
                )
              : null,
        ),
      ),
    );
  }
}
```

</details>

3. start debugging in chrome
4. open chrome debugger and pop it out to a separate window and select console tab
5. make the main chrome window small enough that only shows 3 and half rows at the time
4. focus chrome main window
5. press TAB key repeatedly to cycle focus among the elevated buttons in the app.  When you are on a row, you can press Space key to print the row number to the debug console. This is useful to see which hidden rows that get focus.

**Expected results:** <!-- what did you want to see? -->
* I expect when a row gets keyboard focus, it should be scrolled into visible sight
* I expect when I TAB forward from the navbar button that I should land on row 1.
* I expect when I TAB forward from row 10 to either land first on the URL bar of chrome or on the first button again in NavBar.
* If I stand with focus on the NavBar button and press SHIFT+TAB I expect to possible take a detour via browser URL bar but then reach Row 10 (last row in ListView).

**Actual results:** <!-- what did you see? -->
* When row 10 is focused and visible at the bottom of the list and I press TAB, row 2 gets focus and I have to go through row 2-5 before I get to the NavBar. 
* When NavBar button is focused and list is scrolled to bottom, row 6 (out of view) gets focus and then row 7 (partially in view) 
* If I stand with focus on the NavBar button and press SHIFT+TAB and then SPACE, "Row 9" gets printed to the debug console.

Video of forward movement (I was unable to record SHIFT+TAB reliable in the setup with Windows onscreen keyboard and PowerPoint screen recorder):

https://user-images.githubusercontent.com/4630670/110242497-b6757c80-7f56-11eb-99ea-bc3a3226ddf4.mp4

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->


<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
Analyzing tab_list...
No issues found! (ran in 5.3s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
[✓] Flutter (Channel beta, 2.0.1, on Microsoft Windows [Version 10.0.19041.804], locale sv-SE)
    • Flutter version 2.0.1 at C:\Users\Leif\Programmering\Libraries\flutter
    • Framework revision c5a4b4029c (3 days ago), 2021-03-04 09:47:48 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Leif\Programmering\Android\android-sdks
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[✓] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 1.8.0_242-release-1644-b01)

[✓] VS Code, 32-bit edition (version 1.53.2)
    • VS Code at C:\Program Files (x86)\Microsoft VS Code
    • Flutter extension version 3.20.0

[✓] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.182
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 89.0.774.45

• No issues found!
```

</details>

## Use cases
Accessibility when using Flutter app from keyboard only or using app with voice via speech recognition software that emulate key strokes. Currently ( #77283 ) Flutter do not support using accessibility tools like vimum-c to navigate apps, so users that uses keystrokes to navigate has to use the TAB key in flutter apps.