color-contrast returns elmPartiallyObscured due to subpixel rounding in fullyEncompasses (Firefox/Linux)

Open Beginner friendly
#5,503 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@darshpatel1052 is already working on this.

Since Nov 3, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
html, javascript

Research direction

Start by locating fullyEncompasses() and its tests, then trace how getBackgroundColor uses the containment check for the color-contrast rule. Reproduce the Firefox/Linux case from the issue and check whether a small tolerance fixes the fractional boundary comparison. Done means the low contrast text is reported as a violation in Firefox as it is in Chrome, with relevant tests passing.

Written by the indexing model from the issue text.

Description

ungroomed
Product

axe-core

Product Version

4.14.0 (also reproduces on 4.10.3)

Latest Version
  • I have tested the issue with the latest version of the product
Issue Description
Expectation

On Firefox/Linux, color-contrast should report the low-contrast text as a violation, the same as Chrome does on the same page.

Actual

On Firefox 158 / Linux, color-contrast returns 0 violations and 4 incomplete (elmPartiallyObscured). Chrome reports the violation.

Users testing on Linux Firefox (common in CI) will miss real contrast violations.

How to Reproduce
  1. Firefox 158 on Linux
  2. Open https://qateam.dequecloud.com/attest/api/test.html
  3. Inject axe-core 4.14.0 and run:
    axe.run({ runOnly: ['color-contrast'] })
    
  4. Result: 0 violations, 4 incomplete (elmPartiallyObscured). Chrome reports the violation.
Additional context

Root cause: fullyEncompasses() (used by getBackgroundColor) checks whether the text sits inside the coloured background element with an exact comparison, rect.bottom <= bottom, with no allowance for rounding.

On Linux, Firefox's layout lands on fractional pixel values. The red <p> is the last child of #wcag2aa:

Element bottom
text box of <p> 732.9000244 px
#wcag2aa 732.9000091 px

That ~0.00002 px rounding difference makes axe decide the element is partially obscured. It only affects text that is the last thing inside a coloured box.

Ruled out: same result with and without a display, with a 1920×3000 window, with Times-compatible fonts installed, and on axe-core 4.10.3 and 4.14.0.

Proof / suggested fix: adding a 0.01 px tolerance to that one comparison makes Firefox/Linux report color-contrast (1 violation), matching Chrome.

Dominant language
HTML
Stars
7.8k
Forks
998
Avg merge
2d 22h
Merged PRs (30d)
16

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dequelabs/axe-core

All issues in dequelabs/axe-core

Similar issues

More Accessibility issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.