Skip to content

Commit dff0343

Browse files
authored
Remove autofocus from the a11y_assessments app (#145117)
As of flutter/engine#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.
1 parent 5fb9627 commit dff0343

File tree

9 files changed

+0
-17
lines changed

9 files changed

+0
-17
lines changed

dev/a11y_assessments/lib/main.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ import 'package:flutter/rendering.dart';
88

99
import 'use_cases/use_cases.dart';
1010

11-
// TODO(yjbanov): https://github.com/flutter/flutter/issues/83809
12-
// Currently this app (as most Flutter Web apps) relies on the
13-
// `autofocus` property to guide the a11y focus when navigating
14-
// across routes (screen transitions, dialogs, etc). We may want
15-
// to revisit this after we figure out a long-term story for a11y
16-
// focus. See also https://github.com/flutter/flutter/issues/97747
1711
void main() {
1812
runApp(const App());
1913
if (kIsWeb) {
@@ -66,7 +60,6 @@ class HomePageState extends State<HomePage> {
6660
child: Builder(
6761
builder: (BuildContext context) {
6862
return TextButton(
69-
autofocus: index == 0,
7063
key: Key(useCase.name),
7164
onPressed: () => Navigator.of(context).pushNamed(useCase.route),
7265
child: Text(useCase.name),

dev/a11y_assessments/lib/use_cases/auto_complete.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class _MainWidgetState extends State<_MainWidget> {
3535
static Widget _fieldViewBuilder(BuildContext context, TextEditingController textEditingController, FocusNode focusNode, VoidCallback onFieldSubmitted) {
3636
return TextFormField(
3737
focusNode: focusNode,
38-
autofocus: true,
3938
controller: textEditingController,
4039
onFieldSubmitted: (String value) {
4140
onFieldSubmitted();

dev/a11y_assessments/lib/use_cases/check_box_list_tile.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class _MainWidgetState extends State<_MainWidget> {
3333
body: ListView(
3434
children: <Widget>[
3535
CheckboxListTile(
36-
autofocus: true,
3736
value: _checked,
3837
onChanged: (bool? value) {
3938
setState(() {

dev/a11y_assessments/lib/use_cases/date_picker.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class _MainWidgetState extends State<_MainWidget> {
3636
),
3737
body: Center(
3838
child: TextButton(
39-
autofocus: true,
4039
onPressed: () => showDatePicker(
4140
context: context,
4241
initialEntryMode: DatePickerEntryMode.calendarOnly,

dev/a11y_assessments/lib/use_cases/dialog.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class _MainWidget extends StatelessWidget {
2929
),
3030
body: Center(
3131
child: TextButton(
32-
autofocus: true,
3332
onPressed: () => showDialog<String>(
3433
context: context,
3534
builder: (BuildContext context) => Dialog(
@@ -44,14 +43,12 @@ class _MainWidget extends StatelessWidget {
4443
Row(
4544
children: <Widget>[
4645
TextButton(
47-
autofocus: true,
4846
onPressed: () {
4947
Navigator.pop(context);
5048
},
5149
child: const Text('OK'),
5250
),
5351
TextButton(
54-
autofocus: true,
5552
onPressed: () {
5653
Navigator.pop(context);
5754
},

dev/a11y_assessments/lib/use_cases/material_banner.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class MainWidgetState extends State<MainWidget> {
6464
),
6565
body: Center(
6666
child: ElevatedButton(
67-
autofocus: true,
6867
onPressed: onPress,
6968
child: const Text('Show a MaterialBanner'),
7069
),

dev/a11y_assessments/lib/use_cases/slider.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class MainWidgetState extends State<MainWidget> {
3737
),
3838
body: Center(
3939
child: Slider(
40-
autofocus: true,
4140
value: currentSliderValue,
4241
max: 100,
4342
divisions: 5,

dev/a11y_assessments/lib/use_cases/text_field.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class _MainWidget extends StatelessWidget {
3232
children: <Widget>[
3333
const TextField(
3434
key: Key('enabled text field'),
35-
autofocus: true,
3635
decoration: InputDecoration(
3736
labelText: 'Email',
3837
suffixText: '@gmail.com',

dev/a11y_assessments/lib/use_cases/text_field_password.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class _MainWidget extends StatelessWidget {
3232
children: const <Widget>[
3333
TextField(
3434
key: Key('enabled password'),
35-
autofocus: true,
3635
decoration: InputDecoration(
3736
labelText: 'Password',
3837
hintText: 'Enter your password',

0 commit comments

Comments
 (0)