Input mask: validate on paste cleanup #5271
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds the following functionality:
Strip invalid characters from paste, but keep valid.This is still WIP ― submitting for now to share core functional changes.Related pull requests
Related to #5227.
Preview link
Preview link:
Input mask
Problem statement
Pasting a mix of valid/invalid characters returns an empty string, instead of the valid characters.Solution
line 1051-1058
]getPastedText() → getValidPastedText()
for clarity and accuracy. [50808ab]createStatusMessages()
to accept a user set randomID ― helpful in unit testing.getMaskedElements()
because it wasn't returning anything useful. The passedinputEl
was being returned as a newly namedmaskedEl
.usa-input-mask
wrapper that contained everything. A function like this might return as we continue to develop. [35aff85]for
loops in favor ofremoveFormatCharacters()
[42e9fcb].Major changes
handlepaste()
.getPastedText()
togetValidPastedText()
.