emilk / emilk/egui

nested submenus at screen edge will overlap

Open
#5,251 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

Submenus are usually created to the right side of the parent menu:
![proper_submenus](https://github.com/user-attachments/assets/c7c7c730-f2e4-4131-a24f-7d71c7ce1fec)

If the right screen edge is hit, then the submenus will be placed with their right edge matching the screen edge:
![overlaid_submenus](https://github.com/user-attachments/assets/ad88009b-567f-4f11-9597-2ebc77685057)

In the shown example this will cause a not so optimal appearance, i.e. the submenu will partially cover the parent menu.

If the submenu has a long text, this will cause the submenu to fully overlap the parent menu. This will effectively prohibit the user to move on to the next item in the parent menu, as it is covered and not accessible. I therefore consider this behavior a bug.

This is an example from my application:
![full_overlap](https://github.com/user-attachments/assets/16af4272-d62b-42f6-a113-921bbfd62ba0)

**Expected behavior**
If the space between the right edge of the parent menu and the screen is smaller than the width of the submenu, then the submenu should be displayed to the left side of the parent menu.

It could look similar to this:
![exptected_appearance](https://github.com/user-attachments/assets/f54aca90-33c8-46cb-a087-616a2cf4990a)

I checked with LibreOffice and other applications and it seems a common way to handle this.

I would _really_ appreciate any help on this subject, as this is an annoying behavior in my application. Thank you!

Contributor guide

Open the contributing guide

Research direction

The issue does not name files, tests, or entry points. Start by locating egui's submenu placement and screen-edge handling, then reproduce the reported nested-menu case with a submenu wider than the available space. Done means the submenu moves to the parent menu's left side when it cannot fit on the right, without breaking normal placement.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.