Skip to content

Conversation

@huycozy
Copy link
Member

@huycozy huycozy commented Sep 19, 2025

Then VoiceOver can indicate when the button segment is selected. It's replacing action but not adding because adding (keep both checked and selected) will cause the button to be read with both checked and selected states with Android TalkBack reader that may cause confusion to users (watch demo videos). I also did test with iOS segmented control (storyboard) and Android Jetpack Compose to compare: on these native platforms, it announces selected state (watch demo videos).

Demo Flutter app - after the fix
Flutter Android Flutter iOS
Flutter.Android-.with.fix.mp4
Flutter.iOS-with.fix.mov
Demo native platforms
Android Jetpack Compose iOS segmented control (storyboard)
Android.Jetpack.Compose.mp4
iOS.SwiftUI.mov

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@huycozy huycozy self-assigned this Sep 19, 2025
@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Sep 19, 2025
@huycozy huycozy marked this pull request as ready for review September 19, 2025 04:20
@huycozy huycozy force-pushed the fix-voiceover-not-announce-buttonsegment-state-146987 branch from 0ce17cb to e105cdd Compare September 23, 2025 03:26
@huycozy huycozy requested a review from victorsanni October 1, 2025 02:58
@victorsanni victorsanni requested a review from chunhtai October 1, 2025 17:15
@victorsanni
Copy link
Contributor

Google testing failures are legitimate. The tests print semantics that match the checked/unchecked states which this PR changes to the selected state.

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@huycozy huycozy force-pushed the fix-voiceover-not-announce-buttonsegment-state-146987 branch from e105cdd to 5d44147 Compare October 31, 2025 03:32
@huycozy huycozy added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 31, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Oct 31, 2025

autosubmit label was removed for flutter/flutter/175635, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 31, 2025
@huycozy
Copy link
Member Author

huycozy commented Oct 31, 2025

@chunhtai I fetched the latest code and rebased for this pr, but Google test is still failing. Perhaps need to update them, too? (maybe some tests there rely on checked flag). Could you please give a hand on this?

@Piinks
Copy link
Contributor

Piinks commented Nov 3, 2025

@chunhtai or @victorsanni would one of you be able to take on shepherding this through the Google testing failures? (Thank you in advance 🙏 )

@victorsanni
Copy link
Contributor

Google testing failures are legitimate. The tests print semantics that match the checked/unchecked states which this PR changes to the selected state.

Google testing failures are semantics goldens, same as above. I will liaise with @chunhtai to apply google fixes to unblock this PR.

@Piinks Piinks assigned victorsanni and unassigned huycozy Nov 5, 2025
@victorsanni victorsanni moved this to In Progress in Google Testing Queue Nov 7, 2025
@victorsanni victorsanni moved this from In Progress to Done in Google Testing Queue Nov 7, 2025
@victorsanni victorsanni added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Nov 10, 2025

autosubmit label was removed for flutter/flutter/175635, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
IvoneDjaja pushed a commit to IvoneDjaja/flutter that referenced this pull request Nov 22, 2025
- Fix flutter#146987
- As explained at
flutter#146987 (comment):
this PR proposes _replacing_ `checked` with `selected` here:
 

https://github.com/flutter/flutter/blob/f4de70c6470386db28d23ac5e2e48c681ca23c7a/packages/flutter/lib/src/material/segmented_button.dart#L634
 
Then VoiceOver can indicate when the button segment is selected. It's
_replacing_ action but not _adding_ because _adding_ (keep both
`checked` and `selected`) will cause the button to be read with both
checked and selected states with Android TalkBack reader that may cause
confusion to users (watch demo videos). I also did test with iOS
segmented control (storyboard) and Android Jetpack Compose to compare:
on these native platforms, it announces `selected` state (watch demo
videos).

<details>
<summary>Demo Flutter app - after the fix</summary>

| Flutter Android | Flutter iOS |
| --------------- | --------------- |
<video
src="https://github.com/user-attachments/assets/458c9b78-8275-45db-83cb-b2581505d240"/>
| <video
src="https://github.com/user-attachments/assets/1c69694d-67f8-4f8c-a453-2cf7696e43b5"/>

</details>

<details>
<summary>Demo native platforms</summary>

| Android Jetpack Compose | iOS segmented control (storyboard) |
| --------------- | --------------- |
<video
src="https://github.com/user-attachments/assets/5b682c7e-4c50-49be-a613-58673154aa88"/>
| <video
src="https://github.com/user-attachments/assets/9faba9ea-d373-4756-953a-cde510871247"/>

</details>

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- 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

Signed-off-by: huycozy <[email protected]>
Co-authored-by: Victor Sanni <[email protected]>
mboetger pushed a commit to mboetger/flutter that referenced this pull request Dec 2, 2025
- Fix flutter#146987
- As explained at
flutter#146987 (comment):
this PR proposes _replacing_ `checked` with `selected` here:
 

https://github.com/flutter/flutter/blob/f4de70c6470386db28d23ac5e2e48c681ca23c7a/packages/flutter/lib/src/material/segmented_button.dart#L634
 
Then VoiceOver can indicate when the button segment is selected. It's
_replacing_ action but not _adding_ because _adding_ (keep both
`checked` and `selected`) will cause the button to be read with both
checked and selected states with Android TalkBack reader that may cause
confusion to users (watch demo videos). I also did test with iOS
segmented control (storyboard) and Android Jetpack Compose to compare:
on these native platforms, it announces `selected` state (watch demo
videos).

<details>
<summary>Demo Flutter app - after the fix</summary>

| Flutter Android | Flutter iOS |
| --------------- | --------------- |
<video
src="https://github.com/user-attachments/assets/458c9b78-8275-45db-83cb-b2581505d240"/>
| <video
src="https://github.com/user-attachments/assets/1c69694d-67f8-4f8c-a453-2cf7696e43b5"/>

</details>

<details>
<summary>Demo native platforms</summary>

| Android Jetpack Compose | iOS segmented control (storyboard) |
| --------------- | --------------- |
<video
src="https://github.com/user-attachments/assets/5b682c7e-4c50-49be-a613-58673154aa88"/>
| <video
src="https://github.com/user-attachments/assets/9faba9ea-d373-4756-953a-cde510871247"/>

</details>

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- 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

Signed-off-by: huycozy <[email protected]>
Co-authored-by: Victor Sanni <[email protected]>
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
- Fix flutter#146987
- As explained at
flutter#146987 (comment):
this PR proposes _replacing_ `checked` with `selected` here:
 

https://github.com/flutter/flutter/blob/f4de70c6470386db28d23ac5e2e48c681ca23c7a/packages/flutter/lib/src/material/segmented_button.dart#L634
 
Then VoiceOver can indicate when the button segment is selected. It's
_replacing_ action but not _adding_ because _adding_ (keep both
`checked` and `selected`) will cause the button to be read with both
checked and selected states with Android TalkBack reader that may cause
confusion to users (watch demo videos). I also did test with iOS
segmented control (storyboard) and Android Jetpack Compose to compare:
on these native platforms, it announces `selected` state (watch demo
videos).

<details>
<summary>Demo Flutter app - after the fix</summary>

| Flutter Android | Flutter iOS |
| --------------- | --------------- |
<video
src="https://github.com/user-attachments/assets/458c9b78-8275-45db-83cb-b2581505d240"/>
| <video
src="https://github.com/user-attachments/assets/1c69694d-67f8-4f8c-a453-2cf7696e43b5"/>

</details>

<details>
<summary>Demo native platforms</summary>

| Android Jetpack Compose | iOS segmented control (storyboard) |
| --------------- | --------------- |
<video
src="https://github.com/user-attachments/assets/5b682c7e-4c50-49be-a613-58673154aa88"/>
| <video
src="https://github.com/user-attachments/assets/9faba9ea-d373-4756-953a-cde510871247"/>

</details>

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- 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

Signed-off-by: huycozy <[email protected]>
Co-authored-by: Victor Sanni <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

Development

Successfully merging this pull request may close these issues.

[a11y] VoiceOver does not announce state of ButtonSegment

4 participants