diff --git a/packages/slate-react/src/utils/scroll-to-selection.js b/packages/slate-react/src/utils/scroll-to-selection.js index 6e621d889..0825862e3 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. @@ -15,6 +15,12 @@ const OVERFLOWS = [ 'scroll', ] +/** + * Detect whether we are running IOS version 11 + */ + +const IS_IOS_11 = IS_IOS && !!window.navigator.userAgent.match(/os 11_/i) + /** * Find the nearest parent with scrolling, or window. * @@ -58,6 +64,7 @@ function findScrollContainer(el, window) { */ function scrollToSelection(selection) { + if (IS_IOS_11) return if (!selection.anchorNode) return const window = getWindow(selection.anchorNode)