Skip to content

Commit

Permalink
[a11y] Update semantics in bottom_navigation_bar.dart (flutter#150576)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hannah-hyj authored and sigurdm committed Jun 25, 2024
1 parent 57903b7 commit 6bfcfc2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ class _BottomNavigationTile extends StatelessWidget {

result = Semantics(
selected: selected,
button: true,
container: true,
child: Stack(
children: <Widget>[
Expand Down
16 changes: 15 additions & 1 deletion packages/flutter/test/material/bottom_navigation_bar_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,7 @@ void main() {
matchesSemantics(
label: 'AC\nTab 1 of 3',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
isSelected: true,
hasTapAction: true,
Expand All @@ -2119,6 +2120,7 @@ void main() {
matchesSemantics(
label: 'Alarm\nTab 2 of 3',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
hasTapAction: true,
hasFocusAction: true,
Expand All @@ -2129,6 +2131,7 @@ void main() {
matchesSemantics(
label: 'Hot Tub\nTab 3 of 3',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
hasTapAction: true,
hasFocusAction: true,
Expand Down Expand Up @@ -2165,6 +2168,7 @@ void main() {
matchesSemantics(
label: 'AC\nTab 1 of 3',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
isSelected: true,
hasTapAction: true,
Expand All @@ -2176,6 +2180,7 @@ void main() {
matchesSemantics(
label: 'Alarm\nTab 2 of 3',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
hasTapAction: true,
hasFocusAction: true,
Expand All @@ -2186,6 +2191,7 @@ void main() {
matchesSemantics(
label: 'Hot Tub\nTab 3 of 3',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
hasTapAction: true,
hasFocusAction: true,
Expand Down Expand Up @@ -2518,6 +2524,7 @@ void main() {
matchesSemantics(
label: 'Red\nTab 1 of 2',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
isSelected: true,
hasTapAction: true,
Expand All @@ -2529,6 +2536,7 @@ void main() {
matchesSemantics(
label: 'Green\nTab 2 of 2',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
hasTapAction: true,
hasFocusAction: true,
Expand Down Expand Up @@ -2563,6 +2571,7 @@ void main() {
matchesSemantics(
label: 'Red\nTab 1 of 2',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
isSelected: true,
hasTapAction: true,
Expand All @@ -2574,6 +2583,7 @@ void main() {
matchesSemantics(
label: 'Green\nTab 2 of 2',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
hasTapAction: true,
hasFocusAction: true,
Expand Down Expand Up @@ -2754,6 +2764,7 @@ void main() {
children: <TestSemantics>[
TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
SemanticsFlag.isSelected,
SemanticsFlag.isFocusable,
],
Expand All @@ -2762,7 +2773,10 @@ void main() {
textDirection: TextDirection.ltr,
),
TestSemantics(
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
SemanticsFlag.isFocusable,
],
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
label: 'B\nTab 2 of 2',
textDirection: TextDirection.ltr,
Expand Down

0 comments on commit 6bfcfc2

Please sign in to comment.