Tweaking Material Chip a11y semantics to match buttons - #60141
Merged
Merged
Conversation
gaaclarke
reviewed
Jun 24, 2020
Member
There was a problem hiding this comment.
This seems like the right property to for this:
/// For example, the [Chip] class sets this to false because it can't be
/// disabled, even if no callbacks are set on it, since it is used for
/// displaying information only.
Looking good =)
nscobie
marked this pull request as ready for review
June 25, 2020 00:08
|
Started Google testing for this PR |
|
Google testing passed! |
|
Started Google testing for this PR |
2 similar comments
|
Started Google testing for this PR |
|
Started Google testing for this PR |
|
Started Google testing for this PR |
gaaclarke
reviewed
Jun 26, 2020
|
Started Google testing for this PR |
|
Google testing passed! |
1 similar comment
|
Google testing passed! |
fluttergithubbot
pushed a commit
that referenced
this pull request
Jul 1, 2020
This was referenced Jul 7, 2020
fluttergithubbot
pushed a commit
that referenced
this pull request
Jul 10, 2020
mingwandroid
pushed a commit
to mingwandroid/flutter
that referenced
this pull request
Sep 6, 2020
mingwandroid
pushed a commit
to mingwandroid/flutter
that referenced
this pull request
Sep 6, 2020
mingwandroid
pushed a commit
to mingwandroid/flutter
that referenced
this pull request
Sep 6, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Material Chips generally behave similarly to buttons (excluding the plain info Chip in Flutter which is non-interactive), but are not semantically considered to be buttons for a11y purposes. This leads to subpar feedback for those interacting with Chips in a Flutter app via systems such as TalkBack or VoiceOver. This change brings the Chip a11y semantics in-line with the a11y semantics used for buttons, and matches the behavior of the reference Material components implementations for iOS.
Caveat: the reference implementation for Material components on Android considers some Chips to be "checkable" rather than "buttons". Our implementation for Chip semantics will be further refined in the future to match this behavior by making specific Chip widgets such as
FilterChipandChoiceChipcheckable (see issue #60249 ), while keeping others such asInputChipandActionChipas buttons. We should likely still move forward with this PR to least mark them as buttons for now to unblockcustomer: money (g3)on #58010Related Issues
Tests
I added the following tests:
packages/flutter/test/material/chip_test.dartChip semanticstapEnabled explicitly false(ensures info chips will not be considered buttons)enabled when tapEnabled and canTap(ensures chips which can be tapped, both in general and at this moment, are marked as enabled buttons)disabled when tapEnabled but not canTap(ensures chips which could be tapped, but not currently, are marked as disabled buttons)I updated the following tests to account for newly expected button semantics:
packages/flutter/test/material/chip_test.dartChip semanticslabel onlydeletewith onPressedwith onSelecteddisabledSample App for Manual Testing
Please ignore how bad this app is. :-)
Checklist
///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read [Handling breaking changes].
Note: Five of the tests under
packages/flutter/test/material/chip_test.darthad to be updated since they check for exact matches to semantic trees, but I'm not actually altering anything that I would consider an "API". @Hixie said it's probably fine to not consider this a breaking change.