Close menu after clicking a text menu item#425
Close menu after clicking a text menu item#425Matthew0803 wants to merge 2 commits intoopen-rmf:mainfrom
Conversation
xiyuoh
left a comment
There was a problem hiding this comment.
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, thenDebug Panel - With the panel on the left opened, click on
Toolon the menu bar again - Now click on
Closein 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!
|
@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>
b47e097 to
705bc7b
Compare
|
DCO is fixed. I will try to fix the edge case now. |
Signed-off-by: Matthew0803 <matthewfc83@gmail.com>
Fix appliedThe 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 |
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.