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

error handling readOnly input's validity object and validationMessage #5750

Open
alexmeier-19 opened this issue Nov 18, 2024 · 0 comments
Open

Comments

@alexmeier-19
Copy link

What is affected?

Component

Description

<input id="123" type="number" readOnly></input>

Default step value for this is "1". Now if you set this readOnly input in JS document.getElementById("123").value = "0.5" you'll get following:

input.reportValidity() = true
input.checkValidity() = true

BUT
input.validity Object will have "stepMismatch: true"
and
input.validationMessage = ''.
This seems to be a problem for material-web internal validation logic. It doesn't like a property of the validity object to be 'true' and an empty validationMessage at the same time.

Reproduction

create a number readOnly material web input and set its value to "0.5"

Workaround

Ensure all the inputs would be theoretically valid, although validation shouldn't be triggered in this case.

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

1.5.0

Browser/OS/Node environment

Chrome, Windows

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

No branches or pull requests

1 participant