feat: add options to clear text before typing and to clear text without blurring#1836
Open
levibuzolic wants to merge 1 commit intocallstack:mainfrom
Open
feat: add options to clear text before typing and to clear text without blurring#1836levibuzolic wants to merge 1 commit intocallstack:mainfrom
levibuzolic wants to merge 1 commit intocallstack:mainfrom
Conversation
211becc to
fb570b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
We had a use case where we wanted to clear text in an input without blurring, to more realistically simulate the behaviour of a real user replacing the text of an input.
We needed this because we have some
onBlurbehaviour that would restore a default value, which made replacing the text problematic with the currentclear()andtype()APIs.This can be solved in user-land with a bunch of manual
{Backspace}, but I felt like it probably deserved a first-class API.This PR adds:
clearBeforeas an option touserEvent.type()to allow clearing existing text before entering new text.skipBluras an option touserEvent.clear()to allow clearing text without blurringTest plan
Added unit tests for both new options.