mirror of
https://github.com/zed-industries/zed.git
synced 2026-08-01 19:24:38 +00:00
Closes #10045 follow repro steps: 1. Open the command palette cmd-shift-p. 2. Locate and click language selector: toggle. 3. cmd-shift-p. 4. Click language selector: toggle. 5. Notice that the command palette is closed. When the command palette is reopened on top of the already-open language selector, the palette captures previous_focus_handle before the old modal is hidden. In that case, previous_focus_handle refers to the language selector picker, which is the correct previous focus at that moment. The problem is that this modal is immediately dismissed (as the language toggle gets hidden and command palette is shown in 3rd step) and no longer exists by the time the selected command is confirmed. Fix Updated CommandPalette::toggle so that if another modal is already open, it is dismissed first. Only after that dismissal completes does the command palette capture window.focused(cx) as its previous_focus_handle. This means the command palette now stores the real pre-palette focus target, such as the editor or workspace, instead of storing focus from a modal that is about to be removed. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [ ] Unsafe blocks (if any) have justifying comments - [ ] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [ ] Performance impact has been considered and is acceptable Release Notes: - N/A or Added/Fixed/Improved ... --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| LICENSE-GPL | ||