emilk / emilk/egui

`menu_button` hover doesn't work

Open
#2,864 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Describe the bug**

When using `menu_button`, for example in a context menu, the hover style is only shown for a single frame, or if you hover as far right as possible for some reason (see video).

**To Reproduce**
Steps to reproduce the behavior:
```rust
ui.heading("Context menu").context_menu(|ui| {
ui.menu_button("A", |ui| {
ui.label("...");
});
ui.menu_button("B", |ui| {
ui.label("...");
});
ui.menu_button("Nested", |ui| {
let _ = ui.button("1");
let _ = ui.button("2");
let _ = ui.button("3");
});
});
```

**Expected behavior**
I would expect the menu button to stay hovered for as long as it is actually hovered.

I would also like if the parent item stayed hovered while a child item is hovered, but that is probably harder to implement and maybe out of scope for this bugfix.

**Screenshots**

https://user-images.githubusercontent.com/22177966/229292535-7dbc6bb6-f375-4e65-8407-634c15f1f40d.mp4

Contributor guide

Open the contributing guide

Research direction

Start with the menu_button and context_menu entry points and reproduce the behavior using the Rust example in the issue. Trace hover handling for menu buttons, then verify that the hovered item remains highlighted while the pointer stays over it; parent highlighting during child hover is explicitly out of scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.