Frames inner and outer response are confusing
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
One might think that these two should be equivalent:
```rs
_ = ui.group(|ui| {
let group_label = ui.label("Labelled inside");
ui.response().labelled_by(group_label.id);
ui.label("Duplicate");
});
let group_label = ui.label("Labelled outside");
_ = ui
.group(|ui| {
ui.label("Duplicate");
})
.response
.labelled_by(group_label.id);
```
But they aren't. The first one will work as expected and label the `Response` of the inner `Ui`.
The second one will label the `Response` of the `Frame`s `allocate_rect` call, which doesn't have any children.
I have a couple ideas but none are great.
1. Always return the inner uis response. Would solve this problem, but the rect will be wrong, since it's missing the margin.
2. Return the inner response but mutate it's rect. Slightly better, but e.g. hovered() would now be misleading.
3. Add some way to give a `Ui` a margin. Would remove the need for the extra response. Adds some complexity. But could also be super useful in other places.
Contributor guide
Research direction
Start by tracing the `ui.group` entry point, `Ui::response`, and the `Frame`'s `allocate_rect` call to compare the inner and outer responses. Done means the project has a decided, consistent response and rectangle behavior for these two forms, with the relevant behavior covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100