Unverified Commit dff03432 authored by Yegor's avatar Yegor Committed by GitHub

Remove autofocus from the a11y_assessments app (#145117)

As of https://github.com/flutter/engine/pull/47727 the web engine is able to find a default widget to focus on when a new route it pushed. The mobile engine already did that for some time. So `autofocus` is no longer necessary.
parent 5fb96272
...@@ -8,12 +8,6 @@ import 'package:flutter/rendering.dart'; ...@@ -8,12 +8,6 @@ import 'package:flutter/rendering.dart';
import 'use_cases/use_cases.dart'; import 'use_cases/use_cases.dart';
// TODO(yjbanov): https://github.com/flutter/flutter/issues/83809
// Currently this app (as most Flutter Web apps) relies on the
// `autofocus` property to guide the a11y focus when navigating
// across routes (screen transitions, dialogs, etc). We may want
// to revisit this after we figure out a long-term story for a11y
// focus. See also https://github.com/flutter/flutter/issues/97747
void main() { void main() {
runApp(const App()); runApp(const App());
if (kIsWeb) { if (kIsWeb) {
...@@ -66,7 +60,6 @@ class HomePageState extends State<HomePage> { ...@@ -66,7 +60,6 @@ class HomePageState extends State<HomePage> {
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return TextButton( return TextButton(
autofocus: index == 0,
key: Key(useCase.name), key: Key(useCase.name),
onPressed: () => Navigator.of(context).pushNamed(useCase.route), onPressed: () => Navigator.of(context).pushNamed(useCase.route),
child: Text(useCase.name), child: Text(useCase.name),
......
...@@ -35,7 +35,6 @@ class _MainWidgetState extends State<_MainWidget> { ...@@ -35,7 +35,6 @@ class _MainWidgetState extends State<_MainWidget> {
static Widget _fieldViewBuilder(BuildContext context, TextEditingController textEditingController, FocusNode focusNode, VoidCallback onFieldSubmitted) { static Widget _fieldViewBuilder(BuildContext context, TextEditingController textEditingController, FocusNode focusNode, VoidCallback onFieldSubmitted) {
return TextFormField( return TextFormField(
focusNode: focusNode, focusNode: focusNode,
autofocus: true,
controller: textEditingController, controller: textEditingController,
onFieldSubmitted: (String value) { onFieldSubmitted: (String value) {
onFieldSubmitted(); onFieldSubmitted();
......
...@@ -33,7 +33,6 @@ class _MainWidgetState extends State<_MainWidget> { ...@@ -33,7 +33,6 @@ class _MainWidgetState extends State<_MainWidget> {
body: ListView( body: ListView(
children: <Widget>[ children: <Widget>[
CheckboxListTile( CheckboxListTile(
autofocus: true,
value: _checked, value: _checked,
onChanged: (bool? value) { onChanged: (bool? value) {
setState(() { setState(() {
......
...@@ -36,7 +36,6 @@ class _MainWidgetState extends State<_MainWidget> { ...@@ -36,7 +36,6 @@ class _MainWidgetState extends State<_MainWidget> {
), ),
body: Center( body: Center(
child: TextButton( child: TextButton(
autofocus: true,
onPressed: () => showDatePicker( onPressed: () => showDatePicker(
context: context, context: context,
initialEntryMode: DatePickerEntryMode.calendarOnly, initialEntryMode: DatePickerEntryMode.calendarOnly,
......
...@@ -29,7 +29,6 @@ class _MainWidget extends StatelessWidget { ...@@ -29,7 +29,6 @@ class _MainWidget extends StatelessWidget {
), ),
body: Center( body: Center(
child: TextButton( child: TextButton(
autofocus: true,
onPressed: () => showDialog<String>( onPressed: () => showDialog<String>(
context: context, context: context,
builder: (BuildContext context) => Dialog( builder: (BuildContext context) => Dialog(
...@@ -44,14 +43,12 @@ class _MainWidget extends StatelessWidget { ...@@ -44,14 +43,12 @@ class _MainWidget extends StatelessWidget {
Row( Row(
children: <Widget>[ children: <Widget>[
TextButton( TextButton(
autofocus: true,
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
child: const Text('OK'), child: const Text('OK'),
), ),
TextButton( TextButton(
autofocus: true,
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
......
...@@ -64,7 +64,6 @@ class MainWidgetState extends State<MainWidget> { ...@@ -64,7 +64,6 @@ class MainWidgetState extends State<MainWidget> {
), ),
body: Center( body: Center(
child: ElevatedButton( child: ElevatedButton(
autofocus: true,
onPressed: onPress, onPressed: onPress,
child: const Text('Show a MaterialBanner'), child: const Text('Show a MaterialBanner'),
), ),
......
...@@ -37,7 +37,6 @@ class MainWidgetState extends State<MainWidget> { ...@@ -37,7 +37,6 @@ class MainWidgetState extends State<MainWidget> {
), ),
body: Center( body: Center(
child: Slider( child: Slider(
autofocus: true,
value: currentSliderValue, value: currentSliderValue,
max: 100, max: 100,
divisions: 5, divisions: 5,
......
...@@ -32,7 +32,6 @@ class _MainWidget extends StatelessWidget { ...@@ -32,7 +32,6 @@ class _MainWidget extends StatelessWidget {
children: <Widget>[ children: <Widget>[
const TextField( const TextField(
key: Key('enabled text field'), key: Key('enabled text field'),
autofocus: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'Email', labelText: 'Email',
suffixText: '@gmail.com', suffixText: '@gmail.com',
......
...@@ -32,7 +32,6 @@ class _MainWidget extends StatelessWidget { ...@@ -32,7 +32,6 @@ class _MainWidget extends StatelessWidget {
children: const <Widget>[ children: const <Widget>[
TextField( TextField(
key: Key('enabled password'), key: Key('enabled password'),
autofocus: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: 'Password', labelText: 'Password',
hintText: 'Enter your password', hintText: 'Enter your password',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment