diff --git a/src/app/components/keyfilter/keyfilter.ts b/src/app/components/keyfilter/keyfilter.ts index 1295bb2a572..89206a8f026 100755 --- a/src/app/components/keyfilter/keyfilter.ts +++ b/src/app/components/keyfilter/keyfilter.ts @@ -231,8 +231,9 @@ export class KeyFilter implements Validator { } let valueCheck = this.el.nativeElement.value || ''; - - let val = valueCheck + cc; + const selectionStart = (e.currentTarget).selectionStart || 0; + const selectionEnd = (e.currentTarget).selectionEnd || 0; + let val = valueCheck.substring(0, selectionStart) + cc + valueCheck.substring(selectionEnd); ok = (this.regex).test(val);