fix: prevent closing submenu when switching between items #10152
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Description
Currently, if a submenu is already opened, then opening a submenu for a different item can result in the items having invalid expanded states. This seems to be a regression from switching to the Lit-based component. There is a timing change which results in opening a submenu executing these steps now:
Previously it seems it ran in a different order where closing the submenu would immediately fire the event so that the old item was marked as not expanded, and then only afterwards the new item was marked as expanded.
Aside from the bug, closing and reopening the submenu also resulted in a worse UX as the opening animation of the submenu ran every time you switched to a different parent item.
This changes the submenu opening logic to not close and reopen the menu, so the opened-changed listener is never triggered from this method. Instead:
requestContentUpdateto show the new items (maybe this was why opening and closing was used before)Fixes #10120
Type of change