From 8d22cc258f56c2b333e5982260067e935651ee51 Mon Sep 17 00:00:00 2001 From: Francisco Hodge Date: Tue, 16 Mar 2021 22:02:15 -0400 Subject: [PATCH] v3.0: Reapply fix for checkbox issue per #855 --- src/lib/components/Keyboard.ts | 5 +++-- src/lib/interfaces.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/components/Keyboard.ts b/src/lib/components/Keyboard.ts index 166bb213..a5d0636e 100644 --- a/src/lib/components/Keyboard.ts +++ b/src/lib/components/Keyboard.ts @@ -1078,8 +1078,9 @@ class SimpleKeyboard { if ( (targetTagName === "textarea" || targetTagName === "input") && - "selectionStart" in event.target && - "selectionEnd" in event.target && + ["text", "search", "url", "tel", "password"].includes( + event.target.type + ) && !instance.options.disableCaretPositioning ) { /** diff --git a/src/lib/interfaces.ts b/src/lib/interfaces.ts index 0f35b602..4ba7aa3e 100644 --- a/src/lib/interfaces.ts +++ b/src/lib/interfaces.ts @@ -44,7 +44,7 @@ export type CandidateBoxRenderParams = { } export type KeyboardElement = HTMLDivElement | HTMLButtonElement; -export type KeyboardHandlerEvent = PointerEvent & TouchEvent & KeyboardEvent & { target: HTMLDivElement | HTMLInputElement }; +export type KeyboardHandlerEvent = PointerEvent & TouchEvent & KeyboardEvent & { target: HTMLDivElement & HTMLInputElement }; export interface KeyboardButtonElements { [key: string]: KeyboardElement[]