@@ -105,7 +105,7 @@ class NumberBoxMask extends NumberBoxBase<NumberBoxMaskProperties> {
105105 this . _caretTimeout = undefined ;
106106 const caret = this . _caret ( ) ;
107107
108- if ( caret . start === caret . end && this . _useMaskBehavior ( ) ) {
108+ if ( caret ? .start === caret ? .end && this . _useMaskBehavior ( ) ) {
109109 const text = this . _getInputVal ( ) ;
110110 const decimalSeparatorIndex = this . _getTextSeparatorIndex ( text ) ;
111111
@@ -254,8 +254,8 @@ class NumberBoxMask extends NumberBoxBase<NumberBoxMaskProperties> {
254254 _removeHandler ( e ) {
255255 const caret = this . _caret ( ) ;
256256 const text = this . _getInputVal ( ) ;
257- let { start } = caret ;
258- let { end } = caret ;
257+
258+ let { start = 0 , end = 0 } = caret ?? { } ;
259259
260260 this . _lastKey = getChar ( e ) ;
261261 this . _lastKeyName = normalizeKeyName ( e ) ;
@@ -265,7 +265,11 @@ class NumberBoxMask extends NumberBoxBase<NumberBoxMaskProperties> {
265265
266266 if ( start === end ) {
267267 const caretPosition = start ;
268- const canDelete = isBackspaceKey && caretPosition > 0 || isDeleteKey && caretPosition < text . length ;
268+
269+ const canDelete = isBackspaceKey
270+ && caretPosition > 0
271+ || isDeleteKey
272+ && caretPosition < text . length ;
269273
270274 if ( canDelete ) {
271275 isDeleteKey && end ++ ;
@@ -520,7 +524,7 @@ class NumberBoxMask extends NumberBoxBase<NumberBoxMaskProperties> {
520524 const caret = this . _caret ( ) ;
521525 const point = number . getDecimalSeparator ( ) ;
522526 const pointIndex = this . _getTextSeparatorIndex ( text ) ;
523- const isCaretOnFloat = pointIndex >= 0 && pointIndex < caret . start ;
527+ const isCaretOnFloat = pointIndex >= 0 && pointIndex < ( caret ? .start ?? 0 ) ;
524528 const textParts = this . _removeStubs ( text , true ) . split ( point ) ;
525529
526530 if ( ! isCaretOnFloat || textParts . length !== 2 ) {
@@ -702,7 +706,8 @@ class NumberBoxMask extends NumberBoxBase<NumberBoxMaskProperties> {
702706 }
703707
704708 const caret = this . _caret ( ) ;
705- if ( caret . start !== caret . end ) {
709+
710+ if ( caret ?. start !== caret ?. end ) {
706711 if ( normalizeKeyName ( e ) === MINUS_KEY ) {
707712 this . _applyRevertedSign ( e , caret , true ) ;
708713 return ;
0 commit comments