mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
fix(): scroll assist no longer prevents first click event from firing (#22845)
resolves #21871
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import { pointerCoord } from '../../helpers';
|
import { pointerCoord, raf } from '../../helpers';
|
||||||
|
|
||||||
import { isFocused, relocateInput } from './common';
|
import { isFocused, relocateInput } from './common';
|
||||||
import { getScrollData } from './scroll-data';
|
import { getScrollData } from './scroll-data';
|
||||||
@ -26,7 +26,6 @@ export const enableScrollAssist = (
|
|||||||
// focus this input if the pointer hasn't moved XX pixels
|
// focus this input if the pointer hasn't moved XX pixels
|
||||||
// and the input doesn't already have focus
|
// and the input doesn't already have focus
|
||||||
if (!hasPointerMoved(6, coord, endCoord) && !isFocused(inputEl)) {
|
if (!hasPointerMoved(6, coord, endCoord) && !isFocused(inputEl)) {
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
// begin the input focus process
|
// begin the input focus process
|
||||||
@ -65,6 +64,13 @@ const jsSetFocus = async (
|
|||||||
relocateInput(componentEl, inputEl, true, scrollData.inputSafeY);
|
relocateInput(componentEl, inputEl, true, scrollData.inputSafeY);
|
||||||
inputEl.focus();
|
inputEl.focus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relocating/Focusing input causes the
|
||||||
|
* click event to be cancelled, so
|
||||||
|
* manually fire one here.
|
||||||
|
*/
|
||||||
|
raf(() => componentEl.click());
|
||||||
|
|
||||||
/* tslint:disable-next-line */
|
/* tslint:disable-next-line */
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
let scrollContentTimeout: any;
|
let scrollContentTimeout: any;
|
||||||
|
|||||||
Reference in New Issue
Block a user