Skip to content

Close menu after clicking a text menu item#425

Open
Matthew0803 wants to merge 2 commits intoopen-rmf:mainfrom
Matthew0803:fix/close-menu-on-click
Open

Close menu after clicking a text menu item#425
Matthew0803 wants to merge 2 commits intoopen-rmf:mainfrom
Matthew0803:fix/close-menu-on-click

Conversation

@Matthew0803
Copy link

@Matthew0803 Matthew0803 commented Mar 9, 2026

Bug fix

#393

Fixed bug

The menu is built using a UI library called egui. When you click a button inside a dropdown, the code was firing an event ("hey, this button was clicked!") — but it never told the menu to close itself. So the menu just sat there, open.

Fix applied

After a regular button click, we added one line: ui.close_menu(). That's literally egui's built-in way of saying "close whatever dropdown is currently open." Now when you click an action like "Save As", the event fires and the menu closes.

Screenshot (247)

@mxgrey mxgrey added this to PMC Board Mar 9, 2026
@github-project-automation github-project-automation bot moved this to Inbox in PMC Board Mar 9, 2026
@xiyuoh xiyuoh self-requested a review March 10, 2026 01:08
@xiyuoh xiyuoh moved this from Inbox to In Review in PMC Board Mar 10, 2026
Copy link
Member

@xiyuoh xiyuoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Matthew0803 for the contribution, tested and this works great for me!

I found one particular edge case where the menu item is not properly closed, you may try it out with these steps:

  • On the top menu bar, click on Tool, then Debug Panel
  • With the panel on the left opened, click on Tool on the menu bar again
  • Now click on Close in the side panel
  • You'll see that the Tool submenu is left hanging there. Ideally we'd like it to close as well.

I'm happy to approve this PR first and leave that as a follow up, since the fix is working for this scope. I'll bring this edge case up in the original issue ticket. Feel free to tackle the bug if you'd like!

@xiyuoh
Copy link
Member

xiyuoh commented Mar 10, 2026

@Matthew0803 I'll also need you to fix DCO before I can merge this PR, see https://github.com/open-rmf/rmf_site/pull/425/checks?check_run_id=66229959710

Signed-off-by: Matthew0803 <matthewfc83@gmail.com>
@Matthew0803 Matthew0803 force-pushed the fix/close-menu-on-click branch from b47e097 to 705bc7b Compare March 10, 2026 02:46
@Matthew0803
Copy link
Author

DCO is fixed. I will try to fix the edge case now.

Signed-off-by: Matthew0803 <matthewfc83@gmail.com>
@Matthew0803
Copy link
Author

Fix applied

The fix adds a second check that uses any_click() instead, which fires on a completed click regardless of timing. After all the menu buttons are rendered, if the same menu is still hanging open and a click happened somewhere outside it, we force-close it.

rmf_site.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants