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

Ensure $listboxOption.isSelected / $comboboxOption.isSelected works if item value is false or 0 #4005

Conversation

gdebrauwer
Copy link
Contributor

@gdebrauwer gdebrauwer commented Jan 29, 2024

In my application, I noticed that the selected option is not styled correctly when the value of the selected option is false or 0.

Screen.Recording.2024-01-29.at.14.11.15.mov

This is caused by the isSelected getter on $listboxOption / $comboboxOption. That getter always returns false if the item's value is falsy. That is not correct if the item's value is false or 0. This PR fixes that.

@gdebrauwer gdebrauwer changed the title Ensure $listboxOption.isSelected (and $comboboxOption.isSelected) works if item value is false or 0 Ensure $listboxOption.isSelected / $comboboxOption.isSelected works if item value is false or 0 Jan 29, 2024
@gdebrauwer gdebrauwer changed the title Ensure $listboxOption.isSelected / $comboboxOption.isSelected works if item value is false or 0 Ensure $listboxOption.isSelected / $comboboxOption.isSelected works if item value is false or 0 Jan 29, 2024
@calebporzio
Copy link
Collaborator

Thanks for this! Super valuable!

@calebporzio calebporzio merged commit 5693447 into alpinejs:main Jan 29, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants