Make `ModalCurtain` initial focus configurable
danoc opened this issue · 0 comments
danoc commented
The ModalBase
component focuses on the first focusable element when opening but ModalCurtain
focuses on the modal container. Focusing on the container is better for screen readers since users will be able to read the content of the modal from top to bottom.
Occasionally, it may make sense to skip directly to an input. Take this modal for example:
It's currently not possible to force ModalCurtain
to focus on the input when the modal opens. Even if you grab the ref
of the TextInput
and call .focus()
, the ModalCurtain will take away the focus as soon as its focus trap code runs.
I propose adding an initialFocus
prop that will make this configurable.