Skip to content

sidebar: Fix focus movement to protect zoomed in panels#53386

Merged
danilo-leal merged 5 commits intomainfrom
more-sidebar-focus-movement
Apr 8, 2026
Merged

sidebar: Fix focus movement to protect zoomed in panels#53386
danilo-leal merged 5 commits intomainfrom
more-sidebar-focus-movement

Conversation

@danilo-leal
Copy link
Copy Markdown
Member

@danilo-leal danilo-leal commented Apr 8, 2026

Follow up to #53283. That PR replaced where focus goes — from "always the center pane" to "the saved element." But it didn't fix when focus moves — it still moves every time the sidebar closes, unconditionally. The problem is the saved focus can be wrong... it's saved when the sidebar opens, but then it can go to somewhere else after. An example:

  1. Open sidebar → save focus (center pane), focus sidebar
  2. Open agent panel from sidebar → focus moves to agent panel
  3. Close sidebar → restore saved focus → focuses center pane (that's what was saved in step 1, not the agent panel)

Effectively, this would still cause the agent panel to auto-dismiss. This PR fixes it by no moving focus at all if the sidebar doesn't have it. If the user already moved focus to the agent panel, there's nothing to "restore".

Release Notes:

  • N/A

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Apr 8, 2026
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Apr 8, 2026
@danilo-leal danilo-leal self-assigned this Apr 8, 2026
@danilo-leal danilo-leal enabled auto-merge (squash) April 8, 2026 10:44
@danilo-leal danilo-leal merged commit c32a7c1 into main Apr 8, 2026
30 checks passed
@danilo-leal danilo-leal deleted the more-sidebar-focus-movement branch April 8, 2026 16:29
Caio-Ze pushed a commit to Caio-Ze/postprod-ide that referenced this pull request Apr 8, 2026
…es#53386)

Follow up to zed-industries#53283. That PR
replaced _where_ focus goes — from "always the center pane" to "the
saved element." But it didn't fix _when_ focus moves — it still moves
every time the sidebar closes, unconditionally. The problem is the saved
focus can be wrong... it's saved when the sidebar opens, but then it can
go to somewhere else after. An example:

1. Open sidebar → save focus (center pane), focus sidebar
2. Open agent panel from sidebar → focus moves to agent panel
3. Close sidebar → restore saved focus → **focuses center pane** (that's
what was saved in step 1, not the agent panel)

Effectively, this would still cause the agent panel to auto-dismiss.
This PR fixes it by no moving focus at all if the sidebar doesn't have
it. If the user already moved focus to the agent panel, there's nothing
to "restore".

Release Notes:

- N/A
rtfeldman pushed a commit that referenced this pull request Apr 10, 2026
Follow up to #53283. That PR
replaced _where_ focus goes — from "always the center pane" to "the
saved element." But it didn't fix _when_ focus moves — it still moves
every time the sidebar closes, unconditionally. The problem is the saved
focus can be wrong... it's saved when the sidebar opens, but then it can
go to somewhere else after. An example:

1. Open sidebar → save focus (center pane), focus sidebar
2. Open agent panel from sidebar → focus moves to agent panel
3. Close sidebar → restore saved focus → **focuses center pane** (that's
what was saved in step 1, not the agent panel)

Effectively, this would still cause the agent panel to auto-dismiss.
This PR fixes it by no moving focus at all if the sidebar doesn't have
it. If the user already moved focus to the agent panel, there's nothing
to "restore".

Release Notes:

- N/A
maxbrunsfeld added a commit that referenced this pull request Apr 10, 2026
Cherry-picked PRs (in order applied):

1. #53386
2. #53400
3. #53396
4. #53428
5. #53356
6. #53215
7. #53429
8. #53458
9. #53436
10. #53451
11. #53454
12. #53419
13. #53287
14. #53521
15. #53463
16. #52848
17. #53544
18. #53556
19. #53566
20. #53579
21. #53575
22. #53550
23. #53585
24. #53510
25. #53599
26. #53099
27. #53662
28. #53660
29. #53657
30. #53654


Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Eric Holk <eric@zed.dev>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Cameron Mcloughlin <cameron.studdstreet@gmail.com>
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Katie Geer <katie@zed.dev>
Co-authored-by: ojpro <contact@ojpro.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants