From 75e9ee7e65a00f168ac8b1123d69d2d648dc388c Mon Sep 17 00:00:00 2001 From: Paul <33877645+iampaulmata@users.noreply.github.com> Date: Mon, 17 Aug 2026 18:51:29 -0400 Subject: [PATCH] fix: request redraw on dropdown open/close in the in-window overlay path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Dropdown::new` (the plain constructor used by any non-applet consumer) leaves `window_id`/`on_surface_action` unset, which routes the widget's `overlay()` impl to the in-window overlay path rather than the surface-action-based popup path. On that path, `update()`'s `open` closure and its close counterparts only ever requested a redraw inside the `#[cfg(wayland_platform)] if let Some(...)` block gated on those fields being set — so for the common case, opening or closing a dropdown flipped `is_open` with no redraw requested at all. The stale frame stuck around until some unrelated later event (e.g. cursor motion landing on the now-open/closed menu's bounds) forced a repaint, making the menu appear to not open until the mouse moved, and not close until the same thing happened again on the way out. Add an unconditional `shell.request_redraw()` at each of the three `is_open` transitions that don't already publish a Message of their own (an actual option selection already triggers a normal Message-driven redraw through the app's own update cycle, so that path needed no change): - `open`: right after `is_open` is set true, ahead of the wayland-only surface-action block. - the `close_operation` branch of the open/close operation state machine (`Id`-based programmatic close). - the click-outside-closes-it branch of the mouse/touch press handler. Fixes #1395 --- src/widget/dropdown/widget.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widget/dropdown/widget.rs b/src/widget/dropdown/widget.rs index 696e6c0d..8d80fb4a 100644 --- a/src/widget/dropdown/widget.rs +++ b/src/widget/dropdown/widget.rs @@ -661,6 +661,7 @@ pub fn update< state.close_operation = false; state.is_open.store(false, Ordering::SeqCst); if is_open { + shell.request_redraw(); #[cfg(wayland_platform)] if let Some(ref on_close) = on_surface_action { shell.publish(on_close(surface::action::destroy_popup(state.popup_id))); @@ -684,6 +685,7 @@ pub fn update< // Event wasn't processed by overlay, so cursor was clicked either outside it's // bounds or on the drop-down, either way we close the overlay. state.is_open.store(false, Ordering::Relaxed); + shell.request_redraw(); #[cfg(wayland_platform)] if let Some(on_close) = on_surface_action { shell.publish(on_close(surface::action::destroy_popup(state.popup_id)));