1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-24 17:23:07 +01:00

Prevent default browser scroll on content focus (#2526)

This commit is contained in:
Brendan 2019-01-29 18:13:46 -06:00 committed by Ian Storm Taylor
parent 83e45ac054
commit 861ba522b8

View File

@ -173,9 +173,10 @@ class Content extends React.Component {
}
// If the Slate selection is focused, but the DOM's active element is not
// the editor, we need to focus it.
// the editor, we need to focus it. We prevent scrolling because we handle
// scrolling to the correct selection.
if (selection.isFocused && activeElement !== this.element) {
this.element.focus()
this.element.focus({ preventScroll: true })
updated = true
}