-
Notifications
You must be signed in to change notification settings - Fork 3
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 options with value undefined are selected #1672
Conversation
Using This draft proposes an alternative approach to do that #1671, that we can merge later after the main issue is solved. |
// In multi-select, clear selection for nullish values | ||
if (!value) { | ||
// In multi-select, clear selection for `undefined` values | ||
if (value === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being more explicit on what is the "special" value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test case for the new behavior. Otherwise this looks good.
f834f8b
to
0b32fde
Compare
Done |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1672 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 61 61
Lines 1061 1067 +6
Branches 413 415 +2
=========================================
+ Hits 1061 1067 +6 ☔ View full report in Codecov by Sentry. |
Fix an existing issue in
MultiSelect
, where options with valueundefined
, which special purpose is to clear the selection entirely, setting an empty array, are never marked as selected.Additionally, when this type of option is selected, the listbox is automatically closed regardless of how it is selected (by clicking on it or by clicking on its checkbox). This is because this option will never be selectable together with other options, so it doesn't really make sense to keep it open.
Because of the point above, we should probably consider a different look-and-feel for this type of option, but I'm deferring that.
clear-option-fix-2024-08-21_11.54.59.mp4