-
Notifications
You must be signed in to change notification settings - Fork 813
Open
Milestone
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
onFocusevent 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
isOpenattribute instead of conditional rendering - It works with v2 and React15 in case
closeTimeoutMSis set (I think v3 don't respectcloseTimeoutMSon 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