Skip to content

Wrong a11y wargning on <dialog> with autofocus attribute #9225

Open
@shadow-identity

Description

@shadow-identity

Describe the bug

Ally warning "Avoid using autofocus" appears on <dialog autofocus> element definition.
But using of autofocus on dialog or its descendants is recommended by the standard: https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element

As such, authors should use the autofocus attribute on the descendant element of the dialog that the user is expected to immediately interact with after the dialog opens. If there is no such element, then authors should use the autofocus attribute on the dialog element itself.

Reproduction

<dialog autofocus>
	I'm a dialog
</dialog>

https://svelte.dev/repl/483135a2842e4da6ba6f24ea63430cf2?version=4.2.0

Logs

No response

System Info

N/A

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions