Skip to content

fix: check for bad input when updating _hasInputValue - #5092

Merged
vursen merged 3 commits into
masterfrom
fix/check-for-bad-input-when-updating-has-input-value
Dec 5, 2022
Merged

vursen merged 3 commits into
masterfrom
fix/check-for-bad-input-when-updating-has-input-value

Conversation

@vursen

@vursen vursen commented Dec 1, 2022 •

Copy link
Copy Markdown
Contributor

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.

Comment thread packages/field-base/src/input-mixin.js Resolved
@sonarqubecloud

sonarqubecloud Bot commented Dec 5, 2022

Copy link
Copy Markdown

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
Copy Markdown
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

web-padawan commented Dec 5, 2022 •

Copy link
Copy Markdown
Member

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

vursen commented Dec 5, 2022 •

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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