From 2d1efdbe6dd9436badab4684f2a484476489c166 Mon Sep 17 00:00:00 2001 From: Sean Perkins Date: Thu, 14 Jul 2022 12:20:30 -0400 Subject: [PATCH] perf(input): passive event listener for touch start events (#25610) Resolves #25599 --- core/src/components/input/input.tsx | 3 +-- core/src/utils/input-shims/hacks/scroll-assist.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/components/input/input.tsx b/core/src/components/input/input.tsx index e1e64321b7..1d0d93309e 100644 --- a/core/src/components/input/input.tsx +++ b/core/src/components/input/input.tsx @@ -496,8 +496,7 @@ export class Input implements ComponentInterface { aria-label="reset" type="button" class="input-clear-icon" - onTouchStart={this.clearTextInput} - onMouseDown={this.clearTextInput} + onPointerDown={this.clearTextInput} onKeyDown={this.clearTextOnEnter} /> )} diff --git a/core/src/utils/input-shims/hacks/scroll-assist.ts b/core/src/utils/input-shims/hacks/scroll-assist.ts index 5e404341b9..b58cb76585 100644 --- a/core/src/utils/input-shims/hacks/scroll-assist.ts +++ b/core/src/utils/input-shims/hacks/scroll-assist.ts @@ -31,7 +31,7 @@ export const enableScrollAssist = ( jsSetFocus(componentEl, inputEl, contentEl, footerEl, keyboardHeight); } }; - componentEl.addEventListener('touchstart', touchStart, true); + componentEl.addEventListener('touchstart', touchStart, { capture: true, passive: true }); componentEl.addEventListener('touchend', touchEnd, true); return () => {