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
I wanted to flag some potentially less than ideal behavior related to the SelectMenu component that I noticed while working with this and the SearchField component. Below is more detailed context:
The problem is, that when a user selects an item in the menu, THEN searches using the search field, they get this error: TypeError Cannot read properties of undefined (reading 'current'). This only happens when the selected item has an index that is beyond the range of the filtered MenuItems array.
Improvements
If the number of MenuItems changes in a SelectMenu (like in the example above when the items are filtered using a SearchField), then the selected const should be updated to reflect this change. Otherwise, there will be a TypeError.
Bugs
The text was updated successfully, but these errors were encountered:
Feedback summary
I wanted to flag some potentially less than ideal behavior related to the
SelectMenu
component that I noticed while working with this and theSearchField
component. Below is more detailed context:I was attempting to create a
SelectMenu
that has aSearchField
as its firstMenuItem
. When anMenuItem
is selected, selected is set based on the index in SelectMenu.jsx here. This const is then used to set the offset to scroll to the center of the menu here.The problem is, that when a user selects an item in the menu, THEN searches using the search field, they get this error:
TypeError Cannot read properties of undefined (reading 'current')
. This only happens when the selected item has an index that is beyond the range of the filteredMenuItems
array.Improvements
If the number of
MenuItems
changes in aSelectMenu
(like in the example above when the items are filtered using aSearchField
), then theselected
const should be updated to reflect this change. Otherwise, there will be a TypeError.Bugs
The text was updated successfully, but these errors were encountered: