Provide focus fallback behaviour for firstContentElement
on Modal
#54684
Labels
[Feature] Component System
WordPress component system
[Package] Components
/packages/components
[Type] Enhancement
A suggestion for improvement.
#54590 saw a new value
firstContentElement
for thefocusOnMount
prop ofModal
. This focuses the first element within the Modal's contents as oppposed to anywhere within the Modal.Folks suggested that if the focus algorithm finds no focusable elements in the content, it ought to fallback to finding any focusable element within the entire Modal.
There was some disagreement as to how that would be done.
A
console.warn()
is probably better than nothing, but I'd personally like to find a way to fallback more gracefully. We can always rework the implementation if necessary, especially now that we have a separate value for this behaviour.Originally posted by @ciampo in #54590 (comment)
The text was updated successfully, but these errors were encountered: