emilk / emilk/egui

Combo box tiles are cut off by the scroll bar

Open
#3,205 0 comments 0 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 creating a combo box if there are enough items a scroll bar appears. In that case the selectable values get cut off. This issue persists even when `ui.set_min_width()` is called before.
Example code:
```
egui::ComboBox::from_id_source("Task to show: ")
.selected_text(format!("{}", self.chosen_task))
.show_ui(ui, |ui: &mut egui::Ui| {
ui.style_mut().wrap = Some(false);

for task_i in 0..crate::enums::TASKS_NUM {
let task = Task::from_index(task_i);
ui.selectable_value(&mut self.chosen_task, task, format!("{}", task));
}
});
```
The above code produces this (see the grey area with the cut off text for the 3rd item):
![image](https://github.com/emilk/egui/assets/70060103/3c5200da-5756-4063-b668-0f5f3df196d2)

Selecting the 3rd item almost fixes the issue:
![image](https://github.com/emilk/egui/assets/70060103/6e78706b-0992-47ab-965e-19908b32c418)

Calling `ui.set_min_width(400.0);` inside the ComboBox before placing the selectable values just stretches the grey area:
![image](https://github.com/emilk/egui/assets/70060103/b89f96c6-85f9-4723-b6f0-1c7b8a01655c)

I tried adding a scroll area into the combo box manually, but the issue persists.

Just for reference, this is how the combo box looks with 1 item less, not producing the scroll bar:
![image](https://github.com/emilk/egui/assets/70060103/2e69f0f1-3323-4ace-8327-437acf33114b)

**Build information:**
- OS: Windows 10 Pro 22H2
- Application type: Native (.exe)
- Eframe version: 0.22.0

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the example around ComboBox::from_id_source and show_ui with enough selectable values to trigger a scrollbar, using the latest master as requested. Compare the clipped and non-scrolling cases; done means combo-box items remain fully visible when the scrollbar appears, without relying on set_min_width or a manually added scroll area.

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.