You've already forked gpui-component
mirror of
https://github.com/librekeys/gpui-component.git
synced 2026-04-14 08:46:29 -07:00
f19f896fa1
Follow-up to #2187. When the popover closes, it previously always restored focus to the previously focused element. This could cause a race condition: if another element had already taken focus (e.g., a second popover opening), the restore would incorrectly steal focus back. Fix: only restore the previous focus handle if the popover's focus handle still contains focus at the time of closing. ```diff if let Some(prev) = self.previous_focus_handle.take() { + if self.focus_handle.contains_focused(window, cx) { prev.focus(window, cx); + } } ```