You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle masking in textfield component when user deletes some characters from middle of the text
Solution you'd like
Provide a clear and concise description of the feature behaviour.
Alternatives you've considered
Provide a clear and concise description of any alternative solutions or features you've considered.
Additional context
I was trying this solution but it needs more refactoring and other edge cases to be covered
//TODO: Handle the case when the user deletes the character in the middle of the maskconstcursorPosition=selectionStart||0;event.target.value=maskedValue;value.match(/[^a-zA-Z0-9]/)&&cursorPosition>0&&cursorPosition<maskedValue.length&&!/[^a-zA-Z0-9]/.test(maskedValue[cursorPosition-1])&&event?.target?.setSelectionRange(cursorPosition,cursorPosition);if(value.match(/[^a-zA-Z0-9]/)&&cursorPosition>0&&cursorPosition<maskedValue.length&&/[^a-zA-Z0-9]/.test(maskedValue[cursorPosition-1])){constindexOf=maskedValue.substr(cursorPosition-1).match(/[a-zA-Z0-9]/);if((indexOf?.index||0)>0){constposition=(indexOf?.input||'').length===(indexOf?.index||0)+1 ? indexOf?.index||0 : (indexOf?.index||0)-1;event?.target?.setSelectionRange(cursorPosition+position,cursorPosition+position);}}
The text was updated successfully, but these errors were encountered:
Description
Handle masking in textfield component when user deletes some characters from middle of the text
Solution you'd like
Provide a clear and concise description of the feature behaviour.
Alternatives you've considered
Provide a clear and concise description of any alternative solutions or features you've considered.
Additional context
I was trying this solution but it needs more refactoring and other edge cases to be covered
The text was updated successfully, but these errors were encountered: