-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Validated form controls: Error messages don't reach the interactive element on delegate-based controls #76741
Description
For validated controls that use a hidden element as a validation delegate (ValidatedCustomSelectControl, ValidatedFormTokenField, ValidatedToggleGroupControl), the aria-describedby for the validation error message is attached to the hidden delegate element rather than the interactive control the user actually focuses. This means screen reader users will not hear the validation error when they manually focus back to the control (after the fix for #76694 is in place).
We may need to introduce a getInteractiveTarget() ref alongside getValidityTarget(), so ControlWithError can attach the error description to the element users actually interact with. When refactoring, we should also see if it's feasible or worth switching to a11y.speak() instead of the current declarative setup.