Fix conversation selector popover menu offset (#22796)

Before, the conversation popover menu covered up what you were typing
because it wasn't offset properly.

Now it's offset properly, using the UI font size so the amount of offset
scales with the font size:

<img width="435" alt="Screenshot 2025-01-07 at 4 34 27 PM"
src="https://github.com/user-attachments/assets/55e40910-8cd4-4548-b4fb-521eb2845775"
/>
<img width="454" alt="Screenshot 2025-01-07 at 4 33 58 PM"
src="https://github.com/user-attachments/assets/30350489-09f1-4cb8-9f95-ed4ee87bc110"
/>
<img width="488" alt="Screenshot 2025-01-07 at 4 34 18 PM"
src="https://github.com/user-attachments/assets/de60d990-2bd9-418d-a616-56beb3e4aa8a"
/>

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Richard Feldman 2025-01-08 08:32:48 -05:00 committed by GitHub
parent 68e670bf54
commit 52f29b4a1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 8 deletions

View file

@ -254,13 +254,14 @@ impl<M: ManagedView> Element for PopoverMenu<M> {
let mut menu_layout_id = None;
let menu_element = element_state.menu.borrow_mut().as_mut().map(|menu| {
let offset = self.resolved_offset(cx);
let mut anchored = anchored()
.snap_to_window_with_margin(px(8.))
.anchor(self.anchor);
.anchor(self.anchor)
.offset(offset);
if let Some(child_bounds) = element_state.child_bounds {
anchored = anchored.position(
child_bounds.corner(self.resolved_attach()) + self.resolved_offset(cx),
);
anchored =
anchored.position(child_bounds.corner(self.resolved_attach()) + offset);
}
let mut element = deferred(anchored.child(div().occlude().child(menu.clone())))
.with_priority(1)