Unverified Commit 544527ca authored by Nick Abalov's avatar Nick Abalov Committed by GitHub

Skip links in MinimumTapTargetGuideline. (#93869)

parent c0da4164
......@@ -95,6 +95,9 @@ class MinimumTapTargetGuideline extends AccessibilityGuideline {
&& !data.hasAction(ui.SemanticsAction.tap))
|| data.hasFlag(ui.SemanticsFlag.isHidden))
return result;
// Skip links https://www.w3.org/WAI/WCAG21/Understanding/target-size.html
if (data.hasFlag(ui.SemanticsFlag.isLink))
return result;
Rect paintBounds = node.rect;
SemanticsNode? current = node;
while (current != null) {
......
......@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
......@@ -518,6 +519,35 @@ void main() {
expect(overlappingRightResult.passed, true);
handle.dispose();
});
testWidgets('Does not fail on links', (WidgetTester tester) async {
Widget textWithLink() {
return Builder(
builder: (BuildContext context) {
return RichText(
text: TextSpan(
children: <InlineSpan>[
const TextSpan(
text: 'See examples at ',
),
TextSpan(
text: 'flutter repo',
recognizer: TapGestureRecognizer()
..onTap = () { },
),
],
),
);
},
);
}
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(_boilerplate(textWithLink()));
await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
handle.dispose();
});
});
group('Labeled tappable node guideline', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment