Repository navigation
Chip delete button tap target does not meet platform recommended tap target size #94098
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: chalk (g3)frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Description
Reopening #42455 Chip delete button tap target is too small.
Steps to Reproduce
- Add
androidTapTargetGuidelinetest case topackages/flutter/test/material/chip_test.dart. See code below.testWidgets('delete button tap target complies with minimum tap target guideline', (WidgetTester tester) async { final SemanticsHandle handle = tester.ensureSemantics(); final UniqueKey deleteKey = UniqueKey(); await tester.pumpWidget( _wrapForChip( child: Column( children: <Widget>[ Chip( label: const Text('Label'), deleteIcon: Icon(Icons.delete, key: deleteKey), onDeleted: () { }, ), ], ), ), ); await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); handle.dispose(); });
- Execute
cd packages/flutterandflutter test flutter/test/material/chip_test.dart
Expected results:
- All tests pass
Actual results:
delete button tap target complies with minimum tap target guideline [E]fails withExpected: Tappable objects should be at least Size(48.0, 48.0) Actual: <Instance of 'WidgetTester'> Which: SemanticsNode#5(Rect.fromLTRB(90.0, 12.0, 114.0, 36.0), actions: [tap], flags: [isButton, isFocusable], label: "Delete", textDirection: ltr): expected tap target size of at least Size(48.0, 48.0), but found Size(24.0, 24.0) See also: https://support.google.com/accessibility/android/answer/7101858?hl=en
Flutter Doctor
[✓] Flutter (Channel unknown, 2.6.0-12.0.pre.805, on Debian GNU/Linux rodete 5.10.46-5rodete1-amd64, locale en_US.utf8)
• Flutter version 2.6.0-12.0.pre.805 at /usr/local/google/home/abalov/flutter
• Upstream repository unknown
• Framework revision aee9ade8e3 (60 minutes ago), 2021-11-23 04:03:03 -0500
• Engine revision f4cb61cefc
• Dart version 2.16.0 (build 2.16.0-36.0.dev)
• DevTools version 2.8.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: chalk (g3)frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages teamworkaround availableThere is a workaround available to overcome the issueThere is a workaround available to overcome the issue
Type
Projects
- StatusShow more project fieldsDone (PR merged)
Activity
NickAb commentedon Dec 23, 2021
Any updates?
benjaminwg2017 commentedon Apr 23, 2025
This impacts our app (chalk) as well, see internal b/411597987
flutter-triage-bot commentedon Apr 23, 2025
This issue is missing a priority label. Please set a priority label when adding the
triaged-designlabel.8 remaining items
Piinks commentedon Apr 30, 2025
Marked P2 since we were able to provide a solution to unblock folks for now.
bleroux commentedon May 2, 2025
@Piinks Interesting. For the moment, I'm not sure this issue and #123528 are directly related.
The test from this issues's description does not specify a target platform so it runs on Android (and I can confirm the proposed test is still failing on master).
On Android visual density defaults to
VisualDensity.standardandThemeData.materialTapTargetSizedefaults toMaterialTapTargetSize.padded.See
flutter/packages/flutter/lib/src/material/theme_data.dart
Lines 388 to 397 in 48f87a5
So setting those values does not change the result of the given test.
What I noticed when running your code sample from #94098 (comment) on Android (with or without the workaround)
Enregistrement.de.l.ecran.2025-05-02.a.14.32.07.mov
Enregistrement.de.l.ecran.2025-05-02.a.14.33.03.mov
So it seems to be a problem related to the Semantics object surrounding the delete icon.
I will study Chip implementation and share my findings. First thing I noticed is that Chip does not rely on a Material button for the delete button:
flutter/packages/flutter/lib/src/material/chip.dart
Lines 1267 to 1315 in 48f87a5
bleroux commentedon May 2, 2025
chip.dart implements a custom hit testing strategy which explains why tapping outside of the Icon works.
The code below also contains interesting comments to explain the reasonning:
flutter/packages/flutter/lib/src/material/chip.dart
Lines 2389 to 2426 in 48f87a5
In conclusion, there is some logic to expand the hit area of the delete button, but it won't change the Semantics rect (which is the icon rect).
I will experiment a possible solution for this.
Fix Chip delete button semantic bounds (#168310)
github-actions commentedon May 31, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.