Skip to content

[6.x] Fix Combobox not displaying a selected option with a falsy value#15037

Open
hastinbe wants to merge 1 commit into
statamic:6.xfrom
hastinbe:fix/combobox-falsy-modelvalue
Open

[6.x] Fix Combobox not displaying a selected option with a falsy value#15037
hastinbe wants to merge 1 commit into
statamic:6.xfrom
hastinbe:fix/combobox-falsy-modelvalue

Conversation

@hastinbe

Copy link
Copy Markdown
Contributor

selectedOption, canClearSelection, shouldShowInput, and scrollToSelectedOption all used truthy checks on modelValue to detect "nothing selected". A legitimate value of 0, '', or false was treated the same as null, so certain options would never showed as selected in the trigger. Switched to the explicit modelValue === null check selectedOptions already used correctly.

selectedOption, canClearSelection, shouldShowInput, and
scrollToSelectedOption all used truthy checks on modelValue to detect
"nothing selected". A legitimate value of 0, '', or false was treated
the same as null, so certain options would never showed as
selected in the trigger. Switched to the explicit modelValue === null
check selectedOptions already used correctly.

Signed-off-by: Beau Hastings <beau@saweet.net>
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.

1 participant