-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Modal itself receiving focus rather than first tabbable element #54106
Copy link
Copy link
Closed
Labels
Needs Accessibility FeedbackNeed input from accessibilityNeed input from accessibility[Feature] UI ComponentsImpacts or related to the UI component systemImpacts or related to the UI component system[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).[Package] Components/packages/components/packages/components[Status] In ProgressTracking issues with work in progressTracking issues with work in progress
Metadata
Metadata
Assignees
Labels
Needs Accessibility FeedbackNeed input from accessibilityNeed input from accessibility[Feature] UI ComponentsImpacts or related to the UI component systemImpacts or related to the UI component system[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).[Package] Components/packages/components/packages/components[Status] In ProgressTracking issues with work in progressTracking issues with work in progress
Type
Fields
Give feedbackNo fields configured for issues without a type.
The standard
Modalcomponent defines a tabindex which forces it to be focused when mounted:gutenberg/packages/components/src/modal/index.tsx
Line 232 in 8e0fdca
As this is non-configurable it appears to be a deliberate decision but one that may be questionable from an a11y perspective as noted by @andrewhayward (see below).
Raising this Issue to discuss whether this attribute needs to be reconsidered or made configurable.
What is the rationale behind it and what arguments are there for/against removing it?
For what it's worth, from an accessibility perspective at least, it's actually strongly advised that focus is moved to a control within the dialog, rather than keeping focus on the dialog itself. In this case, where the sole purpose of the dialog is to update the text value, the text field would be a good candidate to automatically receive focus here.
Originally posted by @andrewhayward in #53735 (comment)