Linter: Implement a11y-disabled-attribute rule#1685
Draft
joelhawksley wants to merge 4 commits intomarcoroth:mainfrom
Draft
Linter: Implement a11y-disabled-attribute rule#1685joelhawksley wants to merge 4 commits intomarcoroth:mainfrom
a11y-disabled-attribute rule#1685joelhawksley wants to merge 4 commits intomarcoroth:mainfrom
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement the
a11y-disabled-attributelinter rule from erblint-github'sGitHub::Accessibility::DisabledAttribute.The
disabledHTML attribute is only valid on:button,input,textarea,option,select,fieldset,optgroup, andtask-lists. This rule flags any other element that uses thedisabledattribute, since it has no native browser behavior on those elements and can be misleading to users and assistive technologies.Changes
src/rules/a11y-disabled-attribute.ts— visitor-based rule that checksHTMLOpenTagNodefordisabledattribute on non-allowed elementsdocs/rules/a11y-disabled-attribute.mdrules.tsandrules/index.tsReferences
a11y-disabled-attributerule #1219disabled