Skip to content

Linter: Add a11y-no-autofocus-attribute rule#1487

Open
markokajzer wants to merge 3 commits intomarcoroth:mainfrom
markokajzer:marko/a11y-no-autofocus-attribute
Open

Linter: Add a11y-no-autofocus-attribute rule#1487
markokajzer wants to merge 3 commits intomarcoroth:mainfrom
markokajzer:marko/a11y-no-autofocus-attribute

Conversation

@markokajzer
Copy link
Contributor

closes #177

Linter Rule: No autofocus attribute

Rule: a11y-no-autofocus-attribute

Description

Prevent usage of the autofocus attribute on HTML elements, Action View Form Tag Helpers and Action View Form Builder methods.

Rationale

The autofocus attribute is a global attribute that indicates an element should be focused on page load. It reduces accessibility by moving users to an element without warning and context.

Its use should be limited to form fields that serve as the main purpose of the page, such as a search input on a search page.

@github-actions github-actions bot added documentation Improvements or additions to documentation linter typescript linter-rule labels Mar 24, 2026
Co-authored-by: Marco Roth <marco.roth@intergga.ch>
Signed-off-by: Marko Kajzer <markokajzer91@gmail.com>
@markokajzer markokajzer force-pushed the marko/a11y-no-autofocus-attribute branch from 1863dc8 to 95a0dce Compare March 24, 2026 01:06
@markokajzer
Copy link
Contributor Author

some issues downloading vscode for the vscode:test step right now... unlucky :'(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation linter linter-rule typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linter Rule: No autofocus attribute

2 participants