ComboBox is now wrapped in `horizontal_wrap` container
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
**Describe the bug**
When a combo boxes are placed in wrapping container, they do not wrap when the container size shrinks.
**To Reproduce**
I modified Layout Test from demo app in the following way (just added few buttons and combo boxes):
```diff
diff --git a/crates/egui_demo_lib/src/demo/layout_test.rs b/crates/egui_demo_lib/src/demo/layout_test.rs
index a5726c7a..ee04f0a1 100644
--- a/crates/egui_demo_lib/src/demo/layout_test.rs
+++ b/crates/egui_demo_lib/src/demo/layout_test.rs
@@ -180,5 +180,42 @@ fn demo_ui(ui: &mut Ui) {
let mut dummy = false;
ui.checkbox(&mut dummy, "checkbox");
ui.radio_value(&mut dummy, false, "radio");
- let _ = ui.button("button");
+ let _ = ui.button("button1");
+ let _ = ui.button("button2");
+ let _ = ui.button("button2");
+ let _ = ui.button("button2");
+ let _ = ui.button("button2");
+ let _ = ui.button("button2");
+ let _ = ui.button("button2");
+ let _ = ui.button("button2");
+ let _ = ui.button("button3");
+
+ let alternatives = ["a", "b", "c", "d"];
+ let mut selected = 2;
+ egui::ComboBox::from_label("combobox1").show_index(
+ ui,
+ &mut selected,
+ alternatives.len(),
+ |i| alternatives[i]
+ );
+
+ let mut selected = 2;
+ egui::ComboBox::from_label("combobox2").show_index(
+ ui,
+ &mut selected,
+ alternatives.len(),
+ |i| alternatives[i]
+ );
+
+ let mut selected = 2;
+ egui::ComboBox::from_label("combobox3").show_index(
+ ui,
+ &mut selected,
+ alternatives.len(),
+ |i| alternatives[i]
+ );
+ let _ = ui.button("button2");
+ let _ = ui.button("button2");
+ let _ = ui.button("button2");
+ let _ = ui.button("button3");
}
```
**Expected behavior**
Checkboxes should behave like other widgets.
**Screenshots**
I recorded the modified demo app: https://youtu.be/O5CnZ1KF8D4
Contributor guide
Research direction
Start with crates/egui_demo_lib/src/demo/layout_test.rs and run the layout demo using the reproduction described in the issue. Compare ComboBox behavior with buttons and checkboxes inside a shrinking wrapping container. Done means ComboBox widgets wrap like the other widgets when the container becomes narrower.
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