Block Editor: URLInput: Remove autoFocus as a default prop of URLInput #22440
Labels
[Feature] Link Editing
Link components (LinkControl, URLInput) and integrations (RichText link formatting)
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Package] Block editor
/packages/block-editor
[Type] Task
Issues or PRs that have been broken down into an individual action to take
Previously: #18061 (comment)
Currently,
URLInput
assigns auto-focus to its rendered input. Auto-focus is largely discouraged (we even enforce a rule) and it should not be the default behavior for such a basic component, as it limits (complicates) reusability and makes unnecessary assumptions about its rendering context. It's assumed that this was the default largely based on the assumption that the input is typically rendered within a Popover, which is not something we should be assuming.Task: Avoid assigning
autoFocus
inURLInput
. It should still be supported as an optional (opt-in) prop in cases where it is appropriate. This usage and associated cautions should be sufficiently documented.The text was updated successfully, but these errors were encountered: