Skip to content

a11y/duplicate-id-aria: reports a missing aria-controls target of a collapsed disclosure as an error #2224

Closed

Description

@nc9

Source: MCP feedback fb_265 (run 01M7XFXD7K561E7EJBQSBRHRGV; urun.sh 11/11 pages, aicanvas.me 25/25, dippr.ai).

Seen. a11y/duplicate-id-aria (error, site-wide) reports a MISSING aria-controls target, not a duplicate. urun.sh: <button aria-expanded="false" aria-controls="mobile-nav"> with the panel mounted only when opened. aicanvas.me: React useId ids (_R_cilb_) of collapsed popovers. A collapsed disclosure whose panel is not mounted is accepted (axe aria-valid-attr-value tolerates it). The id/name says "duplicate id", severity is error, and it tops a founder's report.

Where. packages/rules/src/a11y/duplicate-id-aria.ts.

Expected. Ignore aria-controls/aria-owns targets when the same element has aria-expanded="false" (or aria-haspopup); word the message "ARIA reference to a missing id"; keep error for missing aria-labelledby/aria-describedby targets and truly duplicated ids; downgrade the rest to info.

Acceptance Criteria

  • Fixture: aria-expanded="false" aria-controls="x" with no #x produces no error.
  • Fixture: aria-expanded="true" aria-controls="x" with no #x still reports, and a missing aria-labelledby target still errors.
  • Missing-target and duplicate-id findings have distinct messages.

nik

Activity

  1. added
    bug
    size: S
    rules
    on Nov 22, 2026
  2. added theissue type on Nov 22, 2026
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

    bugrulessize: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions