emilk / emilk/egui

Context menu for first element in a horizontal_wrapping layout doesn't open

Open
#2,969 2 comments 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

Self contained example with eframe:
```Rust
use eframe::{egui, NativeOptions};

struct App {}

impl eframe::App for App {
fn update(&mut self, ctx: &eframe::egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.horizontal_wrapped(|ui| {
for _ in 0..100 {
ui.link("Right click me").context_menu(|ui| {
if ui.button("Hello world!").clicked() {
ui.close_menu();
}
});
}
});
});
}
}

fn main() {
eframe::run_native(
"Test app",
NativeOptions::default(),
Box::new(|_| Box::new(App {})),
).unwrap();
}
```

The context menu doesn't open for these links:
![image](https://user-images.githubusercontent.com/1521976/235622562-5b50ee82-88f3-44db-8a72-27df79ee4ccf.png)

eframe 0.21.3
egui 0.21.0

#2962 might be related.

Contributor guide

Open the contributing guide

Research direction

Run the self-contained eframe example and compare the first link with later links in the horizontal_wrapped layout. Start by tracing horizontal_wrapped and context_menu behavior, and check the related #2962 issue. Done means the context menu opens for the first element and the behavior is covered by a regression test.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.