diff --git a/lib/rules/color-contrast-matches.js b/lib/rules/color-contrast-matches.js index 9a75b04b2f..d95b1c3890 100644 --- a/lib/rules/color-contrast-matches.js +++ b/lib/rules/color-contrast-matches.js @@ -1,6 +1,11 @@ /* global document */ import { getAccessibleRefs } from '../commons/aria'; -import { findUpVirtual, visuallyOverlaps, getRootNode } from '../commons/dom'; +import { + findUpVirtual, + visuallyOverlaps, + getRootNode, + isInert +} from '../commons/dom'; import { visibleVirtual, removeUnicode, @@ -35,7 +40,7 @@ function colorContrastMatches(node, virtualNode) { return false; } - if (isDisabled(virtualNode)) { + if (isDisabled(virtualNode) || isInert(virtualNode)) { return false; } diff --git a/test/integration/rules/color-contrast/color-contrast.html b/test/integration/rules/color-contrast/color-contrast.html index 1231e9cf86..dd3a114312 100644 --- a/test/integration/rules/color-contrast/color-contrast.html +++ b/test/integration/rules/color-contrast/color-contrast.html @@ -440,3 +440,11 @@ This div will be on top of the stack + +