Open
Description
Summary:
When conditional render is used - react modal restores focus on unmount without triggering onFocus
event handler on target input.
Steps to reproduce:
- Add
<Modal />
- Focus some input
- Mount/unmount the modal
- Focus restored w/o triggering
onFocus
event handler on the input
Expected behavior:
Input's onFocus
event handler is triggered on focus restore.
Link to example of issue:
React16 and v3: https://codesandbox.io/s/6y6nx2np4k
Additional notes:
- It works in case of using
isOpen
attribute instead of conditional rendering - It works with v2 and React15 in case
closeTimeoutMS
is set (I think v3 don't respectcloseTimeoutMS
on unmount anymore #530 issue prevents using this workaround) - It works in case restore focus in timeout
In case of using for example draft-js
as an input, this bug becomes a cause of the really strange behavior after focus restore.
Metadata
Metadata
Assignees
Labels
No labels