mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 12:41:44 +02:00
Prevent default browser scroll on content focus (#2526)
This commit is contained in:
committed by
Ian Storm Taylor
parent
83e45ac054
commit
861ba522b8
@@ -173,9 +173,10 @@ class Content extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the Slate selection is focused, but the DOM's active element is not
|
// 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) {
|
if (selection.isFocused && activeElement !== this.element) {
|
||||||
this.element.focus()
|
this.element.focus({ preventScroll: true })
|
||||||
updated = true
|
updated = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user