This commit is contained in:
2026-10-30 19:36:39 +07:00
parent b4a996e44c
commit 1711ce0e9d
22 changed files with 300 additions and 485 deletions
+4 -5
View File
@@ -305,7 +305,7 @@ impl RenderOnce for Menu {
};
// Keyboard focus rides the panel across frames.
let focus_handle = window.use_keyed_state("menu-focus", cx, |_, cx| cx.focus_handle());
let focus = gpui_native_utils::focus_handle(&self.id, window, cx);
let scroll = window.use_keyed_state("menu-scroll", cx, |_, _| ScrollHandle::new());
let selected = if *was_open.read(cx) {
@@ -334,7 +334,7 @@ impl RenderOnce for Menu {
let panel = v_flex()
.id("menu-panel")
.track_focus(&focus_handle.read(cx).clone())
.track_focus(&focus)
.role(Role::Menu)
.aria_label(label)
.mt_1()
@@ -371,10 +371,9 @@ impl RenderOnce for Menu {
},
{
let on_change = on_change.clone();
let focus = focus_handle;
move |_, _, window, cx| {
if !focus.read(cx).contains_focused(window, cx) {
window.focus(&focus.read(cx).clone(), cx);
if !focus.contains_focused(window, cx) {
window.focus(&focus, cx);
}
window.on_mouse_event({