Skip to content

Commit

Permalink
[GAR] [a11y] Update text button page in a11y assessment app (flutter#…
Browse files Browse the repository at this point in the history
…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%>
  • Loading branch information
hannah-hyj authored May 30, 2024
1 parent 54573bc commit 1aba3a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
24 changes: 18 additions & 6 deletions dev/a11y_assessments/lib/use_cases/text_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,25 @@ class MainWidgetState extends State<MainWidget> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextButton(
onPressed: () { },
child: const Text('Text button'),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('This is a TextButton:'),
TextButton(
onPressed: () { },
child: const Text('Action'),
),
],
),
const TextButton(
onPressed: null,
child: Text('Text button disabled'),
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('This is a disabled TextButton:'),
TextButton(
onPressed: null,
child: Text('Action'),
),
],
),
],
),
Expand Down
3 changes: 1 addition & 2 deletions dev/a11y_assessments/test/text_button_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'test_utils.dart';
void main() {
testWidgets('text button can run', (WidgetTester tester) async {
await pumpsUseCase(tester, TextButtonUseCase());
expect(find.text('Text button'), findsOneWidget);
expect(find.text('Text button disabled'), findsOneWidget);
expect(find.text('Action'), findsExactly(2));
});
}

0 comments on commit 1aba3a6

Please sign in to comment.