You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the List component with the single selection option and specifying a selectedIndex, you can't deselect the currently selected item.
I am currently using the List and ListItem in a form whereby my ListItem's have [key] properties with string hash based keys and my List component is being passed a selectedIndex that matches the currently selected 'hash'.
What I mean is that if I pass in a selectedIndex of [null, false, undefined, or any non-existent key], the component should fail to select something and there should be no selection as a result. Current behavior is that it simply ignores what you passed in and keeps the previously selected item selected, making it impossible to effectively deselect something.
Whats worse, is that if the reason your selectedIndex no longer matches any of the listItems keys is because the option that is currently selected got removed from the list of items (a perfectly valid scenario) then the List component will simply autoselect the next thing in the list, whether you want it to or not.
I believe this is because the List component is internally storing the current selection by 'array index' and when a new selected key is passed in, it tries to find a matching item and if it can't doesn't bother to update its internal state? I can't think of another explanation for this behavior.
The text was updated successfully, but these errors were encountered:
When using the List component with the single selection option and specifying a selectedIndex, you can't deselect the currently selected item.
I am currently using the List and ListItem in a form whereby my ListItem's have [key] properties with string hash based keys and my List component is being passed a selectedIndex that matches the currently selected 'hash'.
What I mean is that if I pass in a selectedIndex of [null, false, undefined, or any non-existent key], the component should fail to select something and there should be no selection as a result. Current behavior is that it simply ignores what you passed in and keeps the previously selected item selected, making it impossible to effectively deselect something.
Whats worse, is that if the reason your selectedIndex no longer matches any of the listItems keys is because the option that is currently selected got removed from the list of items (a perfectly valid scenario) then the List component will simply autoselect the next thing in the list, whether you want it to or not.
I believe this is because the List component is internally storing the current selection by 'array index' and when a new selected key is passed in, it tries to find a matching item and if it can't doesn't bother to update its internal state? I can't think of another explanation for this behavior.
The text was updated successfully, but these errors were encountered: