momentum-design/momentum-ui

Bug: Multi Select implementation causes unmatchable Unique IDs

Closed this issue · 1 comments

Issue Type

Component or Pattern Affected

Select, SelectOption, CheckBox, ListItem

Expected Behavior

The Multi Select implementation of the Select component tracks 2 pieces of state, selected to render helpful text in the EventOverlay button and selectedIndex to keep track of the currently selected items by reference to their unique IDs.

With every open and close of the EventOverlay, a new List of ListItems containing the SelectOptions and child CheckBoxes is created, always incrementing the ID number concatenated to the end of the list item class like: md-list-item-{ID-number}. The reference to checked boxes stored in selectedIndex remains static while the new overlay content changes, and prevents checkboxes from remaining selected when the user exits and returns to the select drop down.

Current Behavior

When a user opens a Select menu with checkboxes, makes selections, and closes the drop down, the button text reflects the correct number of selections, but when the drop down is opened again, no items are selected.

Possible Solution

Looking at the listContext consumer on line 55 of SelectOption may be a good place to begin.

Steps to Reproduce (for bugs)

Context

This feature is needed for some development teams, and there is not a clear work-around at the moment.

Your Environment

  • Library:
  • Version used:
  • Browser Name and version:
  • Operating System and version:
  • Link to your project:

Resolved with #603