Skip to content
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

Wrapped list of labels with context menus have wrong interaction area #5666

Open
ronnodas opened this issue Feb 2, 2025 · 1 comment
Open
Labels
bug Something is broken

Comments

@ronnodas
Copy link

ronnodas commented Feb 2, 2025

Describe the bug
I have a list of labels each in a horizontal_wrapped(), each with a different context menu. Once a line wraps, interactions with the entire previous line get sent to the label that caused the wrapping (either the one starting the next line or the one spanning across the end of the line) and not the correct label on that line.

To Reproduce
I set up a minimal example at https://github.com/ronnodas/mwe-egui-wrap. If you run it, then skip to step 3, otherwise here's a description of the code:

  1. Have a ui.horizontal_wrapped().
  2. Fill it with ui.label()s with context menus, something like:
for i in 0..50 {
    let text = format!("Label {i}");
    ui.label(&text).context_menu(|ui| ui.label(&text))
}
  1. Right click on one of the labels on the first line.
  2. See the context menu for the first element on the second line.

Expected behavior
Right clicking on "Label n" should produce a menu with "Label n".

Desktop (please complete the following information):

  • OS: WSL (Ubuntu 24.10) on Windows 11

Additional context
This happens on both 0.30.0 and the github version. It also works as expected if you use buttons instead of labels (as the element with the context menu, it doesn't seem to matter what the content of the context menu is).

@ronnodas ronnodas added the bug Something is broken label Feb 2, 2025
@ronnodas
Copy link
Author

ronnodas commented Feb 3, 2025

This seems related to the note about Label not responding to clicks in the docs for context_menu(), since adding .sense(Sense::click()) eliminates the problem. I suppose this issue can be closed, but maybe that note should be clarified since adding a context menu to a label does work by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant