-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix duplicate context menu on right-click in room list item menus #30892
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
base: develop
Are you sure you want to change the base?
Fix duplicate context menu on right-click in room list item menus #30892
Conversation
755abca
to
85fefc5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd probably better to be consistent with the right-click behaviour of the menu, which closes the existing menu and opens a new one where you right clicked.
85fefc5
to
fcdc8c2
Compare
@t3chguy Thank you for the feedback! You're absolutely right about consistency. I've updated the implementation to provide consistent right-click behavior: close the existing menu and open the context menu where clicked. Updated approach:
I've updated the PR with a new video demonstration and an updated description that shows the consistent behavior across both menu types. Added comprehensive test coverage as well |
0741dbc
to
e629995
Compare
f971314
to
86c4dfa
Compare
Looks like your PR causes graphical changes |
86c4dfa
to
5939a06
Compare
5939a06
to
a6d610d
Compare
Yes, fixed it |
Problem
When a room list item menu is open (three dots or notification bell), right-clicking on menu items causes a duplicate context menu to appear, overlaying the existing menu. This creates a confusing UX where users see two identical menus stacked on top of each other.
Root cause
The context menu event bubbles up from menu content to the parent room list item, which has its own context menu handler, triggering a second menu to open.
Solution
Implemented conditional event handling based on menu type and state:
e.stopPropagation()
only when the menu is openif (open)
. This prevents duplicate menus when the more options menu is active, but allows right-click functionality when the menu is closed.setTimeout(() => { setOpen(false); setMenuOpen(false); }, 0)
to close the notification menu when right-clicked, allowing the parent context menu to open naturally without duplication.setMenuOpen
logic inRoomListItemView
to hide hover menus when context menus open, preventing overlapping UI elements.The solution provides consistent right-click behavior across different menu types while preventing the original duplication issue.
Before/After videos
Before (bug reproduction):
1.mov
After (fixed):
2.mov
Checklist
public
/exported
symbols have accurate TSDoc documentation.