Skip to content

Commit d4cffa2

Browse files
authored
[a11y] Update semantics in bottom_navigation_bar.dart (flutter#150576)
issue: flutter#117997 ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent 9988510 commit d4cffa2

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

packages/flutter/lib/src/material/bottom_navigation_bar.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ class _BottomNavigationTile extends StatelessWidget {
605605

606606
result = Semantics(
607607
selected: selected,
608+
button: true,
608609
container: true,
609610
child: Stack(
610611
children: <Widget>[

packages/flutter/test/material/bottom_navigation_bar_test.dart

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,7 @@ void main() {
21082108
matchesSemantics(
21092109
label: 'AC\nTab 1 of 3',
21102110
textDirection: TextDirection.ltr,
2111+
isButton: true,
21112112
isFocusable: true,
21122113
isSelected: true,
21132114
hasTapAction: true,
@@ -2119,6 +2120,7 @@ void main() {
21192120
matchesSemantics(
21202121
label: 'Alarm\nTab 2 of 3',
21212122
textDirection: TextDirection.ltr,
2123+
isButton: true,
21222124
isFocusable: true,
21232125
hasTapAction: true,
21242126
hasFocusAction: true,
@@ -2129,6 +2131,7 @@ void main() {
21292131
matchesSemantics(
21302132
label: 'Hot Tub\nTab 3 of 3',
21312133
textDirection: TextDirection.ltr,
2134+
isButton: true,
21322135
isFocusable: true,
21332136
hasTapAction: true,
21342137
hasFocusAction: true,
@@ -2165,6 +2168,7 @@ void main() {
21652168
matchesSemantics(
21662169
label: 'AC\nTab 1 of 3',
21672170
textDirection: TextDirection.ltr,
2171+
isButton: true,
21682172
isFocusable: true,
21692173
isSelected: true,
21702174
hasTapAction: true,
@@ -2176,6 +2180,7 @@ void main() {
21762180
matchesSemantics(
21772181
label: 'Alarm\nTab 2 of 3',
21782182
textDirection: TextDirection.ltr,
2183+
isButton: true,
21792184
isFocusable: true,
21802185
hasTapAction: true,
21812186
hasFocusAction: true,
@@ -2186,6 +2191,7 @@ void main() {
21862191
matchesSemantics(
21872192
label: 'Hot Tub\nTab 3 of 3',
21882193
textDirection: TextDirection.ltr,
2194+
isButton: true,
21892195
isFocusable: true,
21902196
hasTapAction: true,
21912197
hasFocusAction: true,
@@ -2518,6 +2524,7 @@ void main() {
25182524
matchesSemantics(
25192525
label: 'Red\nTab 1 of 2',
25202526
textDirection: TextDirection.ltr,
2527+
isButton: true,
25212528
isFocusable: true,
25222529
isSelected: true,
25232530
hasTapAction: true,
@@ -2529,6 +2536,7 @@ void main() {
25292536
matchesSemantics(
25302537
label: 'Green\nTab 2 of 2',
25312538
textDirection: TextDirection.ltr,
2539+
isButton: true,
25322540
isFocusable: true,
25332541
hasTapAction: true,
25342542
hasFocusAction: true,
@@ -2563,6 +2571,7 @@ void main() {
25632571
matchesSemantics(
25642572
label: 'Red\nTab 1 of 2',
25652573
textDirection: TextDirection.ltr,
2574+
isButton: true,
25662575
isFocusable: true,
25672576
isSelected: true,
25682577
hasTapAction: true,
@@ -2574,6 +2583,7 @@ void main() {
25742583
matchesSemantics(
25752584
label: 'Green\nTab 2 of 2',
25762585
textDirection: TextDirection.ltr,
2586+
isButton: true,
25772587
isFocusable: true,
25782588
hasTapAction: true,
25792589
hasFocusAction: true,
@@ -2754,6 +2764,7 @@ void main() {
27542764
children: <TestSemantics>[
27552765
TestSemantics(
27562766
flags: <SemanticsFlag>[
2767+
SemanticsFlag.isButton,
27572768
SemanticsFlag.isSelected,
27582769
SemanticsFlag.isFocusable,
27592770
],
@@ -2762,7 +2773,10 @@ void main() {
27622773
textDirection: TextDirection.ltr,
27632774
),
27642775
TestSemantics(
2765-
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
2776+
flags: <SemanticsFlag>[
2777+
SemanticsFlag.isButton,
2778+
SemanticsFlag.isFocusable,
2779+
],
27662780
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
27672781
label: 'B\nTab 2 of 2',
27682782
textDirection: TextDirection.ltr,

0 commit comments

Comments
 (0)