From f7d4c21b64e27f9b655bc1ab2522d6357dc6010f Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Mon, 1 Feb 2021 13:00:33 -0500 Subject: [PATCH] fix(): scroll assist no longer prevents first click event from firing (#22845) resolves #21871 --- core/src/utils/input-shims/hacks/scroll-assist.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/utils/input-shims/hacks/scroll-assist.ts b/core/src/utils/input-shims/hacks/scroll-assist.ts index 939987afb0..d2c8cff6b3 100644 --- a/core/src/utils/input-shims/hacks/scroll-assist.ts +++ b/core/src/utils/input-shims/hacks/scroll-assist.ts @@ -1,4 +1,4 @@ -import { pointerCoord } from '../../helpers'; +import { pointerCoord, raf } from '../../helpers'; import { isFocused, relocateInput } from './common'; import { getScrollData } from './scroll-data'; @@ -26,7 +26,6 @@ export const enableScrollAssist = ( // focus this input if the pointer hasn't moved XX pixels // and the input doesn't already have focus if (!hasPointerMoved(6, coord, endCoord) && !isFocused(inputEl)) { - ev.preventDefault(); ev.stopPropagation(); // begin the input focus process @@ -65,6 +64,13 @@ const jsSetFocus = async ( relocateInput(componentEl, inputEl, true, scrollData.inputSafeY); inputEl.focus(); + /** + * Relocating/Focusing input causes the + * click event to be cancelled, so + * manually fire one here. + */ + raf(() => componentEl.click()); + /* tslint:disable-next-line */ if (typeof window !== 'undefined') { let scrollContentTimeout: any;