From d96a528ac08b1bc77be30dfff7f0395f8b5d3701 Mon Sep 17 00:00:00 2001 From: Sunny Hirai Date: Tue, 9 Jan 2018 13:07:40 -0800 Subject: [PATCH] Fixed scroll-to-selection jumping to top on iOS --- packages/slate-react/src/utils/scroll-to-selection.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/slate-react/src/utils/scroll-to-selection.js b/packages/slate-react/src/utils/scroll-to-selection.js index 6e621d889..a35db0307 100644 --- a/packages/slate-react/src/utils/scroll-to-selection.js +++ b/packages/slate-react/src/utils/scroll-to-selection.js @@ -1,7 +1,7 @@ import getWindow from 'get-window' import isBackward from 'selection-is-backward' -import { IS_SAFARI } from '../constants/environment' +import { IS_SAFARI, IS_IOS } from '../constants/environment' /** * CSS overflow values that would cause scrolling. @@ -58,6 +58,7 @@ function findScrollContainer(el, window) { */ function scrollToSelection(selection) { + if (IS_IOS) return if (!selection.anchorNode) return const window = getWindow(selection.anchorNode)