check method
Inspects nodes — a snapshot captured by SemanticsTreeWalker — and
returns any violations found.
Implementation
@override
List<A11yViolation> check(List<A11ySemanticsNodeInfo> nodes) {
final violations = <A11yViolation>[];
for (final node in nodes) {
if (node.isHidden || node.isTextField || !node.isInteractive) continue;
if (node.label.isNotEmpty ||
node.value.isNotEmpty ||
node.tooltip.isNotEmpty) {
continue;
}
violations.add(
A11yViolation(
ruleId: id,
severity: A11ySeverity.error,
bounds: node.rect,
message:
'Interactive element has no label, value, or tooltip for a '
'screen reader to announce.',
suggestedFix:
'Add Semantics(label: \'...\', child: ...) around the widget, '
'or a semanticLabel/label parameter if the widget already '
'accepts one.',
),
);
}
return violations;
}