fix(): scroll assist no longer prevents first click event from firing (#22845)

resolves #21871
This commit is contained in:
Liam DeBeasi
2021-02-01 13:00:33 -05:00
committed by GitHub
parent fa515eb79b
commit f7d4c21b64

View File

@ -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;