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

Select with required attribute incorrectly reports missing value until value change occurs #2416

Open
m-akinc opened this issue Sep 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@m-akinc
Copy link
Contributor

m-akinc commented Sep 30, 2024

🐛 Bug Report

Form validation on a select with required incorrectly reports a missing value until a value change has occurred. I.e. the initial value is not seen.

💁 Possible Solution

This happens because we try to mirror the initial value to the proxy native select element (within a call to super.slottedOptionsChanged()) before we have mirrored the child option elements. The native select will reject/ignore setting value if it doesn't correspond to the value of one of its child options (of which it has none, at that point). Right after mirroring the child options, there is a call to updateValue(), but because the value has already been updated earlier, it short-circuits, skipping the code path that would have updated the proxy.

@m-akinc m-akinc added bug Something isn't working triage New issue that needs to be reviewed labels Sep 30, 2024
@m-akinc m-akinc removed the triage New issue that needs to be reviewed label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Defined/Ready to Pickup
Development

No branches or pull requests

1 participant