# sidebar: Fix selection highlight flickering when clicking terminal threads \(\#64387\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/d0ae2f05d137d9fe05e4d41aef613572cae950f5)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: d0ae2f05d137d9fe05e4d41aef613572cae950f5

Requested commit: d0ae2f05d137d9fe05e4d41aef613572cae950f5

Commit: d0ae2f05d137d9fe05e4d41aef613572cae950f5

Tree: b80e8a85eac5f314938ff9d8ba00cbf88740d5db

Author: Smit Barmase

Committer: GitHub

## Message

```
sidebar: Fix selection highlight flickering when clicking terminal threads (#64387)

Clear keyboard selection when clicking a terminal thread, as we already
do for agent threads.

The old test cleared selection itself instead of clicking a row. Replace
it with seven scoped tests:

| Test | Action | Expected result |
|---|---|---|
| Different terminal | Terminal A → click Terminal B | B active,
selection cleared |
| Same terminal | Terminal A → click Terminal A | A still active,
selection cleared |
| Different thread | Thread A → click Thread B | B active, selection
cleared |
| Confirm terminal | B active, A selected → Confirm | A active, A still
selected |
| Confirm thread | Thread A selected → Confirm | A active, A still
selected |
| Refocus without selection | Focus outside → sidebar | Search focused,
selection still empty |
| Refocus with selection | Focus outside → sidebar | List focused,
selection preserved |

Each click test starts with the source item active and
keyboard-selected, with the sidebar list focused so the keyboard
highlight is visible.

Before:


https://github.com/user-attachments/assets/eee8bc47-e962-402f-9268-8134dc20ba5b

After:


https://github.com/user-attachments/assets/a437f4c8-b2c0-47d8-99c6-c4600b49c359

Release Notes:

- Fixed the selection highlight flickering in the sidebar when clicking
terminal threads.
```

## Parents

- [49276a3d1dd392e8e16be4827d78deb4556e9ac0](https://git.cafe/gitcafe/zed/commit/49276a3d1dd392e8e16be4827d78deb4556e9ac0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/d0ae2f05d137d9fe05e4d41aef613572cae950f5?format=markdown)
