Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user input #480

Merged
merged 3 commits into from
Jun 12, 2020
Merged

Fix user input #480

merged 3 commits into from
Jun 12, 2020

Conversation

yuriy-fix
Copy link
Contributor

Fixes vaadin/vaadin-text-field-flow#273

Description:
paste is also triggering input event.
In case this event is triggered when value wasn't changed (i.e. value was replaced with paste, or maxlength is set and paste is done), __userInput will be set to true here, but updating the value won't pass polymer dirty check, so the __userInput will be preserved for the next programmatic value update and input value won't be updated.

Important note:
It's possible to check for specifically paste action (i.e. with e.inputType or within onPaste), but it doesn't make sense to preserve __userInput in any case if dirty check won't be passed for valueChange afterwards, so general short solution is implemented in the PR.
(It's easier to test and covers the paste cases, cannot come up with other cases when value won't be changed and input event is triggered)

@yuriy-fix yuriy-fix merged commit 8811ef6 into master Jun 12, 2020
tomivirkki pushed a commit that referenced this pull request Jun 12, 2020
* Add test for user input without value change

* Do not set userInput if there is no change

* Remove flag where it was added
tomivirkki pushed a commit that referenced this pull request Jun 12, 2020
* Add test for user input without value change

* Do not set userInput if there is no change

* Remove flag where it was added
tomivirkki pushed a commit that referenced this pull request Jun 12, 2020
* Add test for user input without value change

* Do not set userInput if there is no change

* Remove flag where it was added
tomivirkki added a commit that referenced this pull request Jun 16, 2020
tomivirkki added a commit that referenced this pull request Jun 16, 2020
tomivirkki added a commit that referenced this pull request Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TextField visual value error when pasting text and maxLength is set
2 participants