Background
While offering feedback for T416597: Add search query highlighting to MultiselectLookup in NamespacesControl and PageTitlesControl, design pointed out a bug in the NamespacesControl component.
Reproduction steps
- User navigates to a page that already has chips populated in the MultiselectLookup
- types text in the input bar, eg "Us"
- selects an item from the filtered menu items, eg "User talk"
- "User talk" chip is populated in the MultiselectLookup component and existing chips are wiped.
Below is a description of a scenario where a user adds a chip without wiping the existing chips.
- User navigates to a page that already has chips populated in the MultiselectLookup
- places cursor in the input bar without typing anything
- keys down or mouses down through the dropdown menu
- selects an item from the menu items, eg "User talk"
- "User talk" chip is populated in the MultiselectLookup component and existing chips remain in place.
The first scenario runs filtering code on the menu items. The second scenario does not. Consequently, I theorize that the filtering code is somehow related to or responsible for this bug. Using debugger statements, I confirmed that the function onNamespacesUpdated runs twice when this bug occurs.
Intriguingly, there is a third scenario where the filtering code is run, and existing chips are not wiped.
- User navigates to a page that already has chips populated in the MultiselectLookup
- places cursor in the input bar without typing anything
- keys down or mouses down through the dropdown menu
- selects an item from the menu items, eg "User talk"
- "User talk" chip is populated in the MultiselectLookup component and existing chips remain in place.
- User types "Us"
- selects "User" from the dropdown menu
- "User" chip is populated in the MultiselectLookup component and existing chips remain in place.
Acceptance Criteria
- When a user types text in NamespacesControl and selects a menu item, the chip is populated without wiping existing chips.




