From 6135d0a19378667b5c53117a37ea800daf9506cc Mon Sep 17 00:00:00 2001 From: Alexander Shabunevich Date: Thu, 12 Jan 2023 23:55:43 +0300 Subject: [PATCH] Fix setSelectionRange error for inputs of some types --- src/mask-input.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mask-input.ts b/src/mask-input.ts index 15fc1dd..8f86d22 100644 --- a/src/mask-input.ts +++ b/src/mask-input.ts @@ -127,7 +127,10 @@ export class MaskInput { e.inputType.startsWith('delete') || (ss != null && ss < valueOld.length) ) { - input.setSelectionRange(ss, se) + try { + // see https://github.com/beholdr/maska/issues/118 + input.setSelectionRange(ss, se) + } catch {} } } }