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

Empty value in <select> option is not displayed #530

Closed
Roland-Gornisiewicz opened this issue Dec 17, 2024 · 3 comments
Closed

Empty value in <select> option is not displayed #530

Roland-Gornisiewicz opened this issue Dec 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Roland-Gornisiewicz
Copy link
Contributor

Roland-Gornisiewicz commented Dec 17, 2024

Summary

Empty value in "select" option is not displayed

Steps to Reproduce

When using a element, an option with an empty value attribute (e.g., value="") does not appear in the dropdown list. This behavior prevents the display of a placeholder or "empty" option when needed. Steps to Reproduce Create a element with an option containing an empty value:

<select data-hs-select='{[..]}' class="hidden">
  <option value="">Empty option</option>
  <option value="1">Option 1</option>
  <option value="2">Option 2</option>
</select>
  1. Open the dropdown in the browser.

  2. Observe that the option with value="" is either missing or not visible.

you can also see it in the documentation:
https://preline.co/docs/advanced-select.html#basic-usage
e.g: section: Basic usage

How can I allow this option to be displayed?

Demo Link

https://preline.co/docs/advanced-select.html#basic-usage

Expected Behavior

No response

Actual Behavior

No response

Screenshots

No response

@lenart
Copy link

lenart commented Dec 27, 2024

Have you tried setting the "placeholder": "Select option..."? That should do the trick. There's also this PR https://github.com/htmlstreamofficial/preline/pull/532/files that seems to change the way filtering of <option ...> is done. Once accepted you would have another option to show empty item(s).

@Roland-Gornisiewicz
Copy link
Contributor Author

Unfortunately, the solution you proposed does not work. The provided example is just a placeholder, and it is not possible to select this option:
image

image

@jahaganiev jahaganiev added the bug Something isn't working label Jan 2, 2025
@jahaganiev
Copy link
Member

The issue has been fixed with the v2.7.0 release, please update to the latest version. @Roland-Gornisiewicz thanks for opening detailed Issue and PR!

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

3 participants