Summary:
In chrome, when the modal closes and focus is restored to an element that is scrolled to a non-default position, the window will scroll. In certain settings, such as an editor component like SlateJS or DraftJS, this jump is disorienting to users.
Steps to reproduce:
- Have focus on an element scrolled near the top of a window
- Open the dialog
- Close the dialog
- Observe that window scrolls to focus on the original element
Expected behavior:
When focus is restored to an element, the window does not scroll
Link to example of issue:
Admittedly having some trouble reproducing this in a fiddle or code sandbox. Sorry :(
Additional notes:
Requires one line change at https://github.com/reactjs/react-modal/blob/master/src/helpers/focusManager.js#L42 to pass { preventScroll: true } to focus()
Summary:
In chrome, when the modal closes and focus is restored to an element that is scrolled to a non-default position, the window will scroll. In certain settings, such as an editor component like SlateJS or DraftJS, this jump is disorienting to users.
Steps to reproduce:
Expected behavior:
When focus is restored to an element, the window does not scroll
Link to example of issue:
Admittedly having some trouble reproducing this in a fiddle or code sandbox. Sorry :(
Additional notes:
Requires one line change at https://github.com/reactjs/react-modal/blob/master/src/helpers/focusManager.js#L42 to pass
{ preventScroll: true }tofocus()