Skip to content

autoFocus input not working within dialog #319

@SamKirkland

Description

@SamKirkland

When using <input autoFocus /> within a modal the input will not be focused because the modal captures focus.
See library code examples or live examples

Appears to be due to focus capture implemented on first render

sentinelStartRef.current.focus();

It might make sense to switch to dialog instead https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog as browser support is solid https://caniuse.com/?search=dialog

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions