kiwicom/orbit

Unable to set focus to buttons inside Modal

Closed this issue · 3 comments

kabh commented

Unable to set focus to buttons inside a Modal.

Expected Behavior

Should be able to set focus via Refs.

Current Behavior

Unable to get focus.

Possible Solution

Steps to Reproduce

https://codesandbox.io/s/orbit-sandbox-f31lj

Context (Environment)

I am looking to set focus when the modal loads automatically to a button in the footer

vepor commented

Thanks for the issue @kabh! Even that managing focus manually is not necessary for Modal component and it breaks the WCAG guidelines then, there is issue inside the ModalFooter component that needs to be fixed.

vepor commented

@kabh Fix released in version 0.48.0. Just make sure the you will call the focus after more than 15 milliseconds, as the Modal is trying to handle the focus on it's own.
https://github.com/kiwicom/orbit-components/blob/76195f5364e1af2bf4bba63fb4a3b55a2cc2cad4/src/Modal/index.js#L363-L374

kabh commented

Thank you !