Skip to content

Linter: Implement a11y-disabled-attribute rule#1685

Draft
joelhawksley wants to merge 4 commits intomarcoroth:mainfrom
joelhawksley:joelhawksley/1219
Draft

Linter: Implement a11y-disabled-attribute rule#1685
joelhawksley wants to merge 4 commits intomarcoroth:mainfrom
joelhawksley:joelhawksley/1219

Conversation

@joelhawksley
Copy link
Copy Markdown
Contributor

Implement the a11y-disabled-attribute linter rule from erblint-github's GitHub::Accessibility::DisabledAttribute.

The disabled HTML attribute is only valid on: button, input, textarea, option, select, fieldset, optgroup, and task-lists. This rule flags any other element that uses the disabled attribute, since it has no native browser behavior on those elements and can be misleading to users and assistive technologies.

Changes

  • Rule source: src/rules/a11y-disabled-attribute.ts — visitor-based rule that checks HTMLOpenTagNode for disabled attribute on non-allowed elements
  • Tests: 16 test cases covering valid elements with disabled, elements without disabled, and invalid elements (a, div, span, p, section, multiple)
  • Docs: docs/rules/a11y-disabled-attribute.md
  • Registered in rules.ts and rules/index.ts
  • Default config: disabled, severity warning

References

Implement the `a11y-disabled-attribute` linter rule from erblint-github's
`GitHub::Accessibility::DisabledAttribute`.

The `disabled` HTML attribute is only valid on: `button`, `input`,
`textarea`, `option`, `select`, `fieldset`, `optgroup`, and
`task-lists`. This rule flags any other element that uses the `disabled`
attribute, since it has no native browser behavior on those elements and
can be misleading to users and assistive technologies.

- Rule source: `src/rules/a11y-disabled-attribute.ts`
- Tests: 16 test cases covering valid elements, elements without disabled,
  and invalid elements (a, div, span, p, section, multiple)
- Docs: `docs/rules/a11y-disabled-attribute.md`
- Registered in `rules.ts` and `rules/index.ts`
- Default config: disabled, severity warning

Closes marcoroth#1219

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation linter typescript a11y linter-rule labels Apr 24, 2026
joelhawksley and others added 3 commits April 24, 2026 08:44
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The new rule increases the 'not enabled' count from 10 to 11.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a11y documentation Improvements or additions to documentation linter linter-rule typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linter: Implement a11y-disabled-attribute rule

1 participant