Skip to content

Commit 1aba3a6

Browse files
authored
[GAR] [a11y] Update text button page in a11y assessment app (#148905)
internal: b/317125569 If the text button label contains its role and state, it will be confusing for tester. it will be announced like "xxx button button" : <img src="https://github.com/flutter/flutter/assets/108393416/16f5a996-b0f1-4f04-bd99-caa3cacd4182" width=50% height=50%> updated screen and label: <img src="https://github.com/flutter/flutter/assets/108393416/1de55cec-8a18-4c36-9dac-84ae7d151fd6" width=50% height=50%>
1 parent 54573bc commit 1aba3a6

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

dev/a11y_assessments/lib/use_cases/text_button.dart

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,25 @@ class MainWidgetState extends State<MainWidget> {
3939
child: Column(
4040
mainAxisAlignment: MainAxisAlignment.center,
4141
children: <Widget>[
42-
TextButton(
43-
onPressed: () { },
44-
child: const Text('Text button'),
42+
Row(
43+
mainAxisAlignment: MainAxisAlignment.center,
44+
children: <Widget>[
45+
const Text('This is a TextButton:'),
46+
TextButton(
47+
onPressed: () { },
48+
child: const Text('Action'),
49+
),
50+
],
4551
),
46-
const TextButton(
47-
onPressed: null,
48-
child: Text('Text button disabled'),
52+
const Row(
53+
mainAxisAlignment: MainAxisAlignment.center,
54+
children: <Widget>[
55+
Text('This is a disabled TextButton:'),
56+
TextButton(
57+
onPressed: null,
58+
child: Text('Action'),
59+
),
60+
],
4961
),
5062
],
5163
),

dev/a11y_assessments/test/text_button_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import 'test_utils.dart';
1010
void main() {
1111
testWidgets('text button can run', (WidgetTester tester) async {
1212
await pumpsUseCase(tester, TextButtonUseCase());
13-
expect(find.text('Text button'), findsOneWidget);
14-
expect(find.text('Text button disabled'), findsOneWidget);
13+
expect(find.text('Action'), findsExactly(2));
1514
});
1615
}

0 commit comments

Comments
 (0)