URL Input outputs with no ID if renderControl undefined #39999
Labels
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
Needs Technical Feedback
Needs testing from a developer perspective.
[Package] Components
/packages/components
[Type] Bug
An existing feature does not function as intended
Description
URLInput does not always output an ID on the input itself, so in certain situations the label doesn't maintain it's relationship to the input.
See below snippet from: https://github.com/WordPress/gutenberg/blob/trunk/packages/block-editor/src/components/url-input/index.js (Line 438)
The input's ID string is only set on controlProps and if the experimental method isn't found it will return the input without an ID at all, as the
BaseControl
doesn't appear to pass the ID prop down to the input (even as part of the child render).Proposed Solution
The ID value should be explicitly set on the input if it's not being output via renderControl. Every input should have an ID or at least an accessible label (which this control currently doesn't).
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Screenshot: https://d.pr/i/Y25JB1
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: