Skip to content

Commit 5eebebb

Browse files
reverting labelContentNameMismatchEvaluate changes it should be in Phase 2
1 parent 2a7bdc8 commit 5eebebb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/checks/label/label-content-name-mismatch-evaluate.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ function labelContentNameMismatchEvaluate(node, options, virtualNode) {
111111
const pixelThreshold = options?.pixelThreshold;
112112
const occurrenceThreshold =
113113
options?.occurrenceThreshold ?? options?.occuranceThreshold;
114+
114115
const accText = accessibleText(node).toLowerCase();
116+
if (isHumanInterpretable(accText) < 1) {
117+
return undefined;
118+
}
119+
115120
const visibleText = sanitize(
116121
subtreeText(virtualNode, {
117122
subtreeDescendant: true,
@@ -125,11 +130,10 @@ function labelContentNameMismatchEvaluate(node, options, virtualNode) {
125130
if (!visibleText) {
126131
return true;
127132
}
128-
129-
if (
130-
isHumanInterpretable(accText) < 1 ||
131-
isHumanInterpretable(visibleText) < 1
132-
) {
133+
if (isHumanInterpretable(visibleText) < 1) {
134+
if (isStringContained(visibleText, accText)) {
135+
return true;
136+
}
133137
return undefined;
134138
}
135139

0 commit comments

Comments
 (0)