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: check for bad input when updating _hasInputValue #5092

Merged

Conversation

vursen
Copy link
Contributor

@vursen vursen commented Dec 1, 2022

Description

Native [type=number] inputs don't update their value when you are entering input that the browser is unable to parse e.g. --5 which results in _hasInputValue not being updated either. To work this out, the PR modifies the computation of _hasInputValue for number-field so that it would additionally check for bad input based on the native validity.badInput property and then update _hasInputValue accordingly.

Related to vaadin/flow-components#4272

Part of vaadin/platform#3066.

Type of change

  • Bugfix

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/contributing/overview
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

packages/field-base/src/input-mixin.js Outdated Show resolved Hide resolved
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vursen vursen merged commit 799d3e5 into master Dec 5, 2022
@vursen vursen deleted the fix/check-for-bad-input-when-updating-has-input-value branch December 5, 2022 13:17
@vaadin-bot
Copy link
Collaborator

Hi @vursen , this commit cannot be picked to 23.3 by this bot, can you take a look and pick it manually?
Error Message: Error: Command failed: git cherry-pick 799d3e5
error: could not apply 799d3e5... fix: check for bad input when updating _hasInputValue (#5092)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

@web-padawan
Copy link
Member

web-padawan commented Dec 5, 2022

I'm not sure if we should cherry-pick this now, but it's probably worth doing. In the future we might want to backport the whole set of validation improvements to a future minor e.g. 23.4 (especially in case it would be sponsored).

@vursen
Copy link
Contributor Author

vursen commented Dec 5, 2022

I'm not sure if we should cherry-pick this now, but it's probably worth doing. In the future we might want to backport the whole set of validation improvements to a future minor e.g. 23.4 (especially in case it would be sponsored).

Sounds reasonable, let's cherry-pick it while it is fresh in our minds.

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.0.0.alpha6 and is also targeting the upcoming stable 24.0.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants