Skip to content

a11y: hidden dialogs and input controls fail accessible-name checks #671

Closed

Description

@deniskern

Companion to #665, which covers a11y/button-name. Independently reviewed before filing.

Summary. squirrel 0.0.108 also reports inaccessible-name failures for elements excluded from the accessibility tree in five sibling rules:

  • a11y/aria-dialog-name
  • a11y/aria-command-name
  • a11y/aria-input-field-name
  • a11y/aria-labels
  • a11y/form-labels

This is about rule applicability while a control is hidden. The same elements may need names when shown; a visible unnamed control must continue to fail. An aria-hidden subtree with focusable descendants can independently violate aria-hidden-focus; this report does not waive that rule.

Live context. On https://www.delife.de/esszimmerstuhl-greg-flex-taupe/a-13896 the fresh sweep reports dialog#configurator-modal as unnamed. It has role="dialog", aria-modal="true", aria-hidden="true" and aria-labelledby="configurator-modal-title"; browser inspection finds the configurator modal closed with display:none and zero layout rectangles. Delife BG and David Dorfmüller also contain closed, unnamed CSS modals, while their visible newsletter/cookie modals have aria-labelledby. That is a candidate-level example, not proof that every Shopware hit is false. The standalone fixtures below reproduce all five sibling rules without live-site dependencies.

Fixture server. Each case is the root document of a separate origin, because the one-page audit starts at the origin root. No DOM is altered after the crawl.

const http = require('node:http');
const bad = '<div role="dialog">Dialog body</div><span role="button" tabindex="0"></span><div role="textbox" tabindex="0"></div><input type="text"><button></button>';
const named = '<div role="dialog" aria-label="Example dialog">Dialog body</div><span role="button" tabindex="0" aria-label="Example command"></span><div role="textbox" tabindex="0" aria-label="Example textbox"></div><input type="text" aria-label="Example input"><button aria-label="Example button"></button>';
const cases = [
  bad,
  named,
  '<style>.closed{display:none}</style><div class="closed">' + bad + '</div>',
  '<div hidden>' + bad + '</div>',
  '<div aria-hidden="true">' + bad + '</div>',
  '<style>.closed{visibility:hidden}</style><div class="closed">' + bad + '</div>',
];
cases.forEach((body, index) => {
  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>Applicability fixture</title></head><body><main><h1>Applicability fixture</h1>' + body + '</main></body></html>');
  }).listen(8780 + index, '127.0.0.1');
});

Commands. Run the server in the background; then audit ports 8780–8785 sequentially:

for port in 8780 8781 8782 8783 8784 8785; do
  squirrel audit "http://127.0.0.1:$port/" --http --refresh --offline -m 1 \
    --rule-include a11y/aria-dialog-name,a11y/aria-command-name,a11y/aria-input-field-name,a11y/form-labels,a11y/aria-labels \
    -f json -o "applicability-$port.json"
done

Actual (spark, squirrel 0.0.108, 2026-10-12 +07).

Case passed / failed Result per rule
Visible unnamed, 8780 0 / 5 All five fail (positive control).
Visible named, 8781 5 / 0 All five pass (negative control).
CSS display:none ancestor, 8782 0 / 5 All five fail.
HTML hidden ancestor, 8783 0 / 5 All five fail.
aria-hidden=true ancestor, 8784 0 / 5 All five fail.
CSS visibility:hidden ancestor, 8785 0 / 5 All five fail.

Warnings and skips are zero in all six cases. Failure messages remain identical across visible and hidden cases: two unnamed command elements, one unnamed dialog, two unnamed input fields, two unnamed buttons, one unlabelled form input. Counts can overlap because multiple rules cover native controls; this report does not request deduplication.

Expected. Exclude the hidden fixture descendants from these accessible-name/label checks while they are excluded from the accessibility tree. Retain visible unnamed failures and visible named passes. See WAI-ARIA 1.2: tree exclusion for display:none, visibility:hidden, HTML hidden and aria-hidden.

Local action. No suppression or template disable added.

Acceptance Criteria

Activity

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

    @nc9
    Contributor

    Spec prep

    Verdict: confirmed on current main for all five rules (e95e0f5, v0.0.112). Read from source.

    None of the five rules consult a visibility helper. The shared resolver createStaticVisibility (packages/rules/src/shared/static-hidden.ts, from pub#675/#676, shipped in v0.0.109) is used only by a11y/aria-hidden-focus and a11y/button-name:

    • aria-dialog-name.ts: hasAccessibleName and unnamedDialogItems, over [role=dialog], [role=alertdialog] and native dialog
    • aria-command-name.ts: commandRoles, button and a[href]
    • aria-input-field-name.ts: inputRoles, inputs, textarea and select
    • aria-labels.ts: the aria-buttons and aria-svg checks
    • form-labels.ts: inputs, textarea and select

    Dependency on #678 (affects the acceptance criteria)

    Two of the six fixtures, 8782 (display:none) and 8785 (visibility:hidden), hide through a class rule in a <style> block. By design the shared resolver does not read <style> blocks. That part is #678, still open, with the cascade attempt parked on wip/static-hidden-cascade-664-665.

    After this fix:

    It is reported today because its aria-labelledby target is most likely empty in the server HTML: the rule reads the referenced element's textContent.

    Suggest either rewording criterion 1 to "markup and inline-style hiding, as in #665; <style> rules tracked in #678", or leaving this issue open until #678 lands, as #664 and #665 are.

    Change: apply the button-name.ts pattern to each rule

    • In run(): const visibility = createStaticVisibility({ ariaHidden: true }).
    • For each unnamed element only (the visibility read stays cheap):
      • hidden: count it, add hiddenWithoutName to the pass details, and switch the pass message to the "in the accessibility tree" wording button-name uses.
      • unknown: a <check>-unconfirmed warn with UNCONFIRMED_LABEL.
      • shown: today's failure, unchanged.
    • Keep existing check names and messages.
    • Extend each meta.solution with the hidden and unconfirmed sentence from button-name.
    • aria-hidden-focus is untouched (it uses ariaHidden: false), so criterion 4 holds by construction.

    Notes per rule:

    • aria-dialog-name: a native <dialog> without open is hidden by the user-agent stylesheet, so the resolver says hidden. The dialog-name warning then stops firing for closed dialogs, which is nearly every native dialog in static HTML. That matches ACT applicability (axe also skips hidden elements), but it makes that check close to inert. See open question 1.
    • aria-labels (aria-svg): the resolver's comment says it does not reach SVG or MathML elements. Pin with a test what it returns for an interactive <svg> inside a hidden HTML ancestor.
    • form-labels and aria-input-field-name: input[type=hidden] is already excluded by their selectors.

    Tests

    New packages/rules/tests/a11y-name-rules-hidden.test.ts, one describe per rule, modelled on button-name-hidden.test.ts. Build parsePage contexts from the reporter's six cases. For each rule:

    • bad fails and named passes.
    • hidden and aria-hidden ancestors are not reported, and neither is an inline style="display:none" ancestor.
    • The <style> display:none and visibility:hidden cases still fail. Pin them so the test flips visibly when a11y/aria-hidden-focus, a11y/button-name: evaluate hiding by <style> rules without false hidden results #678 lands.
    • The configurator-modal markup (role=dialog aria-modal aria-hidden aria-labelledby pointing at an empty title) is not reported.
    • Off-screen, sr-only and disabled controls are not treated as hidden.
    • An inline style the reader cannot parse gives the unconfirmed warn.

    Re-run aria-dialog-name.test.ts, button-name-hidden.test.ts and aria-hidden-focus-css-hidden.test.ts with explicit paths. packages/rules/tests/fixtures/static-hidden-chromium.json is the Chromium-verified guard if any new reading is added (none should be).

    Docs, skills, completions

    • The five rule pages, docs/rules/a11y/{aria-dialog-name,aria-command-name,aria-input-field-name,aria-labels,form-labels}.mdx:
      • add the new *-unconfirmed checks with message templates;
      • add the hidden-element paragraph (copy it from button-name.mdx).
    • Run make validate. No skill or completion change.

    Risks

    • Score: a hidden unnamed control moves from fail to pass; an unreadable inline style moves from fail to warn. Nothing that passed before can warn or fail.
    • New check names appear in reports. Rule count is unchanged, and v1/v2 golden parity should hold.

    Open questions for the maintainer

    1. Closed native dialogs: skip them silently (the ACT and axe behaviour), or keep a low-severity info saying "N hidden dialog(s) have no accessible name; they need one when opened"? I recommend the info: dialogs are hidden by design until opened.
    2. The criterion wording versus a11y/aria-hidden-focus, a11y/button-name: evaluate hiding by <style> rules without false hidden results #678 (above).

    Recommended session

    Sonnet, medium effort. The pattern exists, so this is five mechanical applications plus tests. Size M confirmed.

  3. nc9 commented on Oct 13, 2026

    @nc9
    Contributor

    Triage note: per the spec prep, <style>-block class rules still depend on #678 (also gating #664/#665). Criterion 1 is satisfied for inline-style, hidden, aria-hidden and display:none attribute cases; the <style> rule fixtures (8782, 8785) clear with #678. Keeping this issue open until both land.

  4. nc9 commented on Oct 16, 2026

    @nc9
    Contributor

    Verified on main 8024e29 (pub#833 merged as 862709f): packages/rules/tests/a11y-name-rules-hidden-671.test.ts 47/47 pass.

    Met, ticked: visible unnamed control still fails each of the five rules; named variants pass; aria-hidden-focus still reports a visible focusable control in an aria-hidden subtree (aria-hidden-focus-css-hidden.test.ts); the reporter's configurator-modal produces no finding; all five rules use the shared shared/static-hidden.ts helper, with tests per rule.

    Not met: criterion 1 for hiding set by a <style> block (the test pins it as "not read yet (pub#678): still fails"). Markup, the hidden attribute, aria-hidden and inline styles are covered. Leaving open until #678 lands, same as #664 and #665.

  5. added a commit that references this issue on Oct 21, 2026
    21c90c0
  6. deniskern commented on Nov 8, 2026

    @deniskern
    Author

    Minimal HTML: <dialog aria-labelledby="details-title"><h2 id="details-title"></h2><button></button></dialog>; code sets title text and button name immediately before showModal. .173 warns about the closed native dialog although its empty heading/button are excluded; a genuinely open unnamed dialog remains actionable. Tagged code explicitly sets closedDialogsShown: true referencing #462, so request a state/confidence distinction, not unconditional removal of native-dialog naming. Expected: do not call the inaccessible initial state a demonstrated unnamed open dialog; check name after the opener populates it or report a future-state/unverified recommendation. Reuse #671 discussion before filing any duplicate.

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