Skip to content

[Bug]: "required" problem because of empty option at the end of options #858

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

Open
xenatis opened this issue Jan 9, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@xenatis
Copy link

xenatis commented Jan 9, 2025

Bug description

When removing any selected option, an empty option element is added at the end of the option list.

For a required select element to be detected by document.foms.myForm.checkValidity() the empty option should be at the top of options.

allowEmptyOption value do not have any impact on this behavior.

Expected behavior

Empty option element should be added at top of the options, not at the end.

Steps to reproduce

  1. Go to https://jsfiddle.net/jkqe2fL4/
  2. Click on "check" button
  3. Look at console. Should be true.
  4. Remove Thomas Edison
  5. Click on "check" button
  6. As there is no selected option, console should show "false". It shows "true".

Additional context

Chrome Version 131.0.6778.204 (Official Build) (64-bit)
Firefox 128.5.0esr (64-bit)
Debian 11

@xenatis xenatis added the bug Something isn't working label Jan 9, 2025
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
None yet
Development

No branches or pull requests

1 participant