Skip to content

Rules do not see controls inside a declarative shadow root (<template shadowrootmode>) #922

Closed

Description

@nc9

A page built with web components can render its controls inside a declarative shadow root, using <template shadowrootmode="open">. The browser parser attaches that template's content as the host's shadow root and renders it. squirrelscan parses the page with linkedom, which keeps the content inside the template's content fragment. document.querySelectorAll never reaches it there, so no rule sees those controls.

For example, this button has no accessible name. Chromium renders it, but a11y/button-name does not report it:

<div><template shadowrootmode="open"><button></button></template></div>

The same gap applies to every DOM-based rule: links, images, headings and form fields inside declarative shadow roots.

Acceptance Criteria

  • An unnamed <button> inside <template shadowrootmode="open"> (or "closed") is reported by a11y/button-name, the same as one in the light DOM.
  • A plain <template> with no shadowrootmode is still treated as inert: its content is not checked.
  • The rule docs say whether shadow-root content is checked.

Activity

  1. added
    enhancement
    size: M
    rules
    on Oct 17, 2026
  2. added theissue type on Oct 28, 2026
  3. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.144 (commits 6c1a0fd, 7d7f353, 206e8e4). Checked every acceptance criterion against current main: controls inside a declarative shadow root are visible to the rules, with tests.

    nik

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

    enhancementrulessize: M

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions