emilk / emilk/egui

`group` widgets ignore horizontal wrapping

Open
#1,996 5 comments 8 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 `ui.group()` inside something like `ui.horizontal_wrapped()`, the widgets seem to ignore wrapping and just keep going well past screen boundaries. I went crazy trying to figure out why my UI was overflowing, until I removed the group and it started wrapping as expected.

**To Reproduce**

I put together this simple sample with eframe that triggers the issue:

```rust
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use eframe::egui;

#[derive(Default)]
struct DummyApp;

impl eframe::App for DummyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, | ui | {
ui.horizontal_wrapped(| ui | {
for n in 0..500 {
ui.group(| ui | {
ui.strong(format!("Number {n}"));
});
}
});
});
}
}
fn main() {
let app = DummyApp::default();
let native_options = eframe::NativeOptions::default();

eframe::run_native("wrap_test", native_options, Box::new(|_| Box::new(app)));
}
```

**Expected behavior**

The widgets don't overflow, and they keep going on a new row.

Screenshots

- UI goes off-screen.

![image](https://user-images.githubusercontent.com/16805474/188048725-1ed87d8f-5f1f-425c-acf8-bad76d5f899b.png)

---

- Wraps as expected without the group

![image](https://user-images.githubusercontent.com/16805474/188049193-e655278d-071e-404f-a219-b0fa1b0fe092.png)

**Desktop (please complete the following information):**
- OS: Windows
- Version: 10

Let me know if anything else is needed here :)

Contributor guide

Open the contributing guide

Research direction

Start by running the minimal eframe example from the issue and compare ui.group() with the same widgets directly inside ui.horizontal_wrapped(). Trace how these two entry points determine available width and wrapping; done means grouped widgets stay within the panel and continue on new rows.

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.