Skip to content

a11y/aria-hidden-focus: CSS-hidden descendants reported as focusable in HTTP mode #664

Closed

Description

@deniskern

Independent review: PASS (2026-10-11), after reproducing all six variants on spark.

Summary. squirrel 0.0.108 in --http mode reports 1 focusable element(s) inside aria-hidden for a button inside a container hidden by display:none or visibility:hidden. The same button without hiding is correctly reported; HTML hidden, inert and disabled controls are not reported. This reproduction covers static CSS declared in the document, not JavaScript-driven visibility changes.

Live examples (2026-10-11). https://www.delife.bg/: reported a#geolocationModalAccept belongs to .modal.fade[aria-hidden=true]; in the loaded browser it has zero client rectangles because the closed modal has no layout. https://david-dorfmueller.de/: the reported scroll-up submit button has computed visibility:hidden. These examples show candidates for this defect, not proof that all findings on either site are false positives.

Repro. Save as hidden-focus-repro.cjs:

const http=require('node:http');const variants={'/bad.html':'<div aria-hidden="true"><button>Close</button></div>','/display-none.html':'<style>.modal{display:none}</style><div class="modal" aria-hidden="true"><button>Close</button></div>','/hidden.html':'<div hidden aria-hidden="true"><button>Close</button></div>','/visibility-hidden.html':'<style>.modal{visibility:hidden}</style><div class="modal" aria-hidden="true"><button>Close</button></div>','/inert.html':'<div inert aria-hidden="true"><button>Close</button></div>','/disabled.html':'<div aria-hidden="true"><button disabled>Close</button></div>'};http.createServer((req,res)=>{res.setHeader('Content-Type','text/html; charset=utf-8');res.end('<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Hidden focus fixture</title></head><body><h1>Fixture</h1>'+(variants[req.url]??'Fixture')+'</body></html>')}).listen(8768,'127.0.0.1');
node hidden-focus-repro.cjs

In another terminal:

squirrel --version
for variant in bad display-none hidden visibility-hidden inert disabled; do
  squirrel audit "http://127.0.0.1:8768/$variant.html" --http --refresh -m 1 -f json -o "$variant.json" --rule-include a11y/aria-hidden-focus
done

Actual (spark-onedot, 2026-10-11): every fixture crawled 1 page on 0.0.108. bad, display-none, visibility-hidden each emit a11y/aria-hidden-focus, check aria-hidden-focus, status fail, message 1 focusable element(s) inside aria-hidden. hidden, inert, disabled each emit issues: [].

Expected: preserve the finding for bad. CSS-hidden controls cannot enter sequential focus navigation; do not present them as proven focusable. If HTTP mode cannot determine the applicable CSS, report that limitation or an unconfirmed candidate rather than a conformance failure. Do not suppress off-screen but focusable content or assume a closed dialog remains hidden after interaction.

Reference: W3C ACT rule 6cfa84, especially Passed Example 2 and the CSS Styling input aspect.

Acceptance Criteria

  • In --http mode, a control inside an aria-hidden container hidden by static display:none or visibility:hidden (inline style or a document <style> rule) is not reported as a focusable failure.
  • The visible bad fixture is still reported; hidden, inert and disabled fixtures still pass.
  • When the applicable CSS cannot be determined in HTTP mode, the finding is marked unconfirmed (or skipped with a stated limitation), not a conformance failure.
  • Off-screen but focusable content is still reported.
  • The CSS-hidden check is shared with a11y/button-name (a11y/button-name: hidden controls reported as unnamed buttons #665), not duplicated.
  • Tests cover the six fixtures from the repro.

Activity

  1. added
    bug
    P2
    rules
    size: M
    on Oct 11, 2026
  2. nc9 commented on Oct 11, 2026

    @nc9
    Contributor

    Thanks Denis. Confirmed on current main: a11y/aria-hidden-focus already skips inert and hidden ancestors, but nothing looks at static CSS, so display:none and visibility:hidden containers are reported in HTTP mode. Triaged as a bug (P2), size M, area rules. I added acceptance criteria. #664 and #665 need the same "removed from the accessibility tree by static CSS" helper, so I'll queue them together and share it. Where HTTP mode cannot tell, the finding should say so rather than claim a failure.

  3. nc9 commented on Oct 11, 2026

    @nc9
    Contributor

    Reproduced on 0.0.108 with the repro script (port changed). bad, display-none and visibility-hidden each give a11y/aria-hidden-focus, check aria-hidden-focus, status fail, 1 focusable element(s) inside aria-hidden. hidden, inert and disabled pass.

    origin/main still has this: isOutOfFocusTree in packages/rules/src/a11y/aria-hidden-focus.ts checks only inert and hidden. There is already a markup-only helper, isHiddenFromMarkup in packages/parser/src/hidden-markup.ts (used by a11y/empty-heading), but it reads inline style only, not <style> rules, so it would not clear the display-none or visibility-hidden fixtures as written.

  4. nc9 commented on Oct 11, 2026

    @nc9
    Contributor

    pub#675 merged: aria-hidden-focus no longer reports controls hidden by markup (hidden attribute, closed dialog, popover, template) or by a plainly written inline display:none or visibility:hidden. Hiding by <style> rules and external stylesheets is not evaluated yet, so the display-none and visibility-hidden fixtures from this issue still report. That part is tracked in #678. Leaving this open until #678 lands.

  5. nc9 commented on Oct 12, 2026

    @nc9
    Contributor

    Release check 2026-10-12 (v0.0.109): the markup and inline-style paths shipped (pub#675/#676 in v0.0.109), but the criterion about hiding set by a document <style> rule is not met: that part was deliberately deferred to #678. Leaving open until #678.

  6. added a commit that references this issue on Oct 17, 2026
    21c90c0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2bugrulessize: M

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions