menu: Fix scrollbar can't drag to bottom of scrollable PopupMenu. (#984)

| Before | After |
|--| -- |
| <img width="166" alt="image"
src="https://github.com/user-attachments/assets/883eb78b-9ea3-4f1b-b01e-81fbbbdd39ed"
/> | <img width="166" alt="image"
src="https://github.com/user-attachments/assets/9ba551aa-5d9e-49ed-adfa-3da6c654f0c4"
/>|

Ref #979 but not fix.
This commit is contained in:
Jason Lee 2025-06-18 17:31:56 +08:00 committed by GitHub
parent 1752d3e2b4
commit 4c87c72f60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -897,7 +897,6 @@ impl Render for PopupMenu {
.popover_style(cx)
.text_color(cx.theme().popover_foreground)
.relative()
.p_1()
.child(
div()
.id("items")
@ -908,6 +907,7 @@ impl Render for PopupMenu {
})
.child(
v_flex()
.p_1()
.gap_y_0p5()
.min_w(rems(8.))
.when_some(self.min_width, |this, min_width| this.min_w(min_width))
@ -924,9 +924,9 @@ impl Render for PopupMenu {
self.menu_items
.iter()
.enumerate()
// Skip last separator
// Ignore last separator
.filter(|(ix, item)| {
!(*ix == items_count - 1 && item.is_separator())
!(*ix + 1 == items_count && item.is_separator())
})
.map(|(ix, item)| {
self.render_item(ix, item, item_state, window, cx)