[a11y] Update semantics in bottom_navigation_bar.dart (#150576)

issue: https://github.com/flutter/flutter/issues/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
This commit is contained in:
hangyu 2024-06-21 14:48:41 -07:00 committed by GitHub
parent 9988510e34
commit d4cffa2540
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View file

@ -605,6 +605,7 @@ class _BottomNavigationTile extends StatelessWidget {
result = Semantics(
selected: selected,
button: true,
container: true,
child: Stack(
children: <Widget>[

View file

@ -2108,6 +2108,7 @@ void main() {
matchesSemantics(
label: 'AC\nTab 1 of 3',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
isSelected: true,
hasTapAction: true,
@ -2119,6 +2120,7 @@ void main() {
matchesSemantics(
label: 'Alarm\nTab 2 of 3',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
hasTapAction: true,
hasFocusAction: true,
@ -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,
@ -2165,6 +2168,7 @@ void main() {
matchesSemantics(
label: 'AC\nTab 1 of 3',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
isSelected: true,
hasTapAction: true,
@ -2176,6 +2180,7 @@ void main() {
matchesSemantics(
label: 'Alarm\nTab 2 of 3',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
hasTapAction: true,
hasFocusAction: true,
@ -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,
@ -2518,6 +2524,7 @@ void main() {
matchesSemantics(
label: 'Red\nTab 1 of 2',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
isSelected: true,
hasTapAction: true,
@ -2529,6 +2536,7 @@ void main() {
matchesSemantics(
label: 'Green\nTab 2 of 2',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
hasTapAction: true,
hasFocusAction: true,
@ -2563,6 +2571,7 @@ void main() {
matchesSemantics(
label: 'Red\nTab 1 of 2',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
isSelected: true,
hasTapAction: true,
@ -2574,6 +2583,7 @@ void main() {
matchesSemantics(
label: 'Green\nTab 2 of 2',
textDirection: TextDirection.ltr,
isButton: true,
isFocusable: true,
hasTapAction: true,
hasFocusAction: true,
@ -2754,6 +2764,7 @@ void main() {
children: <TestSemantics>[
TestSemantics(
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
SemanticsFlag.isSelected,
SemanticsFlag.isFocusable,
],
@ -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,