mirror of
https://github.com/flutter/flutter
synced 2024-08-27 03:50:33 +00:00
MinimumTextContrastGuideline should exclude disabled component (#94489)
This commit is contained in:
parent
bccc9eaca7
commit
049ea73c4d
|
@ -212,7 +212,10 @@ class MinimumTextContrastGuideline extends AccessibilityGuideline {
|
|||
|
||||
Future<Evaluation> evaluateNode(SemanticsNode node) async {
|
||||
Evaluation result = const Evaluation.pass();
|
||||
if (node.isInvisible || node.isMergedIntoParent || node.hasFlag(ui.SemanticsFlag.isHidden))
|
||||
if (node.isInvisible ||
|
||||
node.isMergedIntoParent ||
|
||||
node.hasFlag(ui.SemanticsFlag.isHidden) ||
|
||||
(node.hasFlag(ui.SemanticsFlag.hasEnabledState) && !node.hasFlag(ui.SemanticsFlag.isEnabled)))
|
||||
return result;
|
||||
final SemanticsData data = node.getSemanticsData();
|
||||
final List<SemanticsNode> children = <SemanticsNode>[];
|
||||
|
|
|
@ -177,6 +177,29 @@ void main() {
|
|||
expect(result.passed, true);
|
||||
handle.dispose();
|
||||
});
|
||||
|
||||
testWidgets('Disabled button is excluded from text contrast guideline', (WidgetTester tester) async {
|
||||
// Regression test https://github.com/flutter/flutter/issues/94428
|
||||
final SemanticsHandle handle = tester.ensureSemantics();
|
||||
await tester.pumpWidget(
|
||||
_boilerplate(
|
||||
ElevatedButton(
|
||||
onPressed: null,
|
||||
child: Container(
|
||||
width: 200.0,
|
||||
height: 200.0,
|
||||
color: Colors.yellow,
|
||||
child: const Text(
|
||||
'this is a test',
|
||||
style: TextStyle(fontSize: 14.0, color: Colors.yellowAccent),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
await expectLater(tester, meetsGuideline(textContrastGuideline));
|
||||
handle.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
group('custom minimum contrast guideline', () {
|
||||
|
|
Loading…
Reference in a new issue