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[]