Skip to content
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

[paragon-openedx.netlify.app] Feedback (on /components/menu/select-menu/) #2996

Open
varshamenon4 opened this issue Jan 25, 2024 · 0 comments
Labels

Comments

@varshamenon4
Copy link
Member

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 the SearchField component. Below is more detailed context:

I was attempting to create a SelectMenu that has a SearchField as its first MenuItem. When an MenuItem 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.

image

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.

Screenshot 2024-01-25 at 2 31 20 PM

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant