Skip to content

context menu can go outside the window when too far right #1176

@jakobhellermann

Description

@jakobhellermann

Describe the bug
When a context menu is opened too close to the edge of the window, most of it is clipped and not accessible.

To Reproduce
Add a menu button to the UI close to the right edge of the window.

ui.with_layout(Layout::right_to_left(), |ui| {
    ui.menu_button("Add", |ui| {
        if ui.button("Option 1").clicked() {
            ui.close_menu();
        }
        if ui.button("Option 2, which is longer").clicked() {
            ui.close_menu();
        }
    });
});

Expected behavior
It would be cool if the popup location was constrained so that it didn't move past the window boundary. (Once that is implemented, the submenus could also open to the left, but that should be another issue).

Screenshots
grafik

Metadata

Metadata

Assignees

Labels

bugSomething is broken

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions