Skip links in MinimumTapTargetGuideline. (#93869)
This commit is contained in:
@@ -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', () {
|
||||
|
||||
Reference in New Issue
Block a user