Repository navigation
A click anywhere in a sidebar worktree row selects it #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ZmeiGorynych
merged 10 commits into
main
from
egor/dev-2080-worktree-term-clicking-anywhere-on-a-sidebar-worktree-row
Oct 15, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
91c0b18
Archive the merged worktree-name-search OpenSpec change
ZmeiGorynych 038bbcb
Plan: a click anywhere in a sidebar worktree row selects it
ZmeiGorynych 65c7b98
Failing e2e tests: a click anywhere in a sidebar worktree row selects…
ZmeiGorynych 0184237
A click anywhere in a sidebar worktree row selects it; the checkbox o…
ZmeiGorynych 9b9af60
Migrate the architecture model to the two-file layout living-architec…
ZmeiGorynych 9aab3f6
Tick the final gates of the row-click change
ZmeiGorynych b0cb9d1
Pin CI to living-architecture 0.3.1, which reads the two-file archite…
ZmeiGorynych 6a002b3
Point the README at living-architecture 0.3.1, the version CI now ins…
ZmeiGorynych 6977f54
Keep a daemon from removing a socket that replaced its own
ZmeiGorynych 7e96bf6
Archive the row-click change into the web spec
ZmeiGorynych File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
...6-10-15-dev-2080-worktree-term-clicking-anywhere-on-a-sidebar-worktree-row/.openspec.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| schema: spec-driven | ||
| created: 2026-10-12 |
20 changes: 20 additions & 0 deletions
20
...15-dev-2080-worktree-term-clicking-anywhere-on-a-sidebar-worktree-row/design.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| ## Context | ||
|
|
||
| `WorktreeEntry` (`src/web/ui/app.tsx`) puts the select handler on the nested `.label` button, so the hit target is whatever box that child occupies; the `.worktree` row around it (padding, flex gaps, the strips above and below the label and the star, the mark) does nothing on click. Repo tabs already handle the click on the whole tab, with inner controls stopping propagation. | ||
|
|
||
| ## Goals / Non-Goals | ||
|
|
||
| **Goals:** the row is the click target, so no future child layout can shrink it again. | ||
|
|
||
| **Non-Goals:** the 5px list padding outside the rows; the context menu, prunable and gone behaviour. | ||
|
|
||
| ## Decisions | ||
|
|
||
| - **The row owns the click.** `.worktree` gets `onClick` → `view.selectWorktree(path)`; the label button loses its own `onClick`. Alternative rejected: stretching the label (CSS or a `::after` overlay) — still leaves the star column and gaps as special cases. | ||
| - **The label stays the keyboard control.** Enter/Space on the button fire a click that bubbles to the row; the row gets no role or `tabIndex`, avoiding a second tab stop. The row's handler carries `// NOSONAR(S6848) — a pointer shortcut; the label button is the keyboard control`, as at the pane container. | ||
| - **The star stops propagation.** Its `onClick` calls `event.stopPropagation()`, so toggling never selects. Clicks above or below the 18px star (29px row) select — a stray select is harmless, a stray star toggle is persisted and shared. | ||
| - **Cursor.** `cursor: pointer` moves from `.worktree .label` to `.worktree`. | ||
|
|
||
| ## Risks / Trade-offs | ||
|
|
||
| - [A future in-row control forgets to stop propagation and also selects] → the checkbox e2e scenario shows the pattern; the repo-tab close button does the same. |
21 changes: 21 additions & 0 deletions
21
...-dev-2080-worktree-term-clicking-anywhere-on-a-sidebar-worktree-row/proposal.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| ## Why | ||
|
|
||
| A sidebar worktree switches only when the click lands on its branch-name text: the row is at least 29px tall, but only the text-tall label button inside it handles the click, so clicks above or below the text — between two names — do nothing. | ||
|
|
||
| ## What Changes | ||
|
|
||
| - Web: a primary click anywhere in a worktree's row selects it; its checkbox still only toggles the star; a right-click still opens the worktree menu without selecting. The label stays the row's keyboard control (Enter or Space selects). | ||
| - The whole row shows the pointer cursor. | ||
|
|
||
| ## Capabilities | ||
|
|
||
| ### New Capabilities | ||
|
|
||
| ### Modified Capabilities | ||
| - `web`: the worktree sidebar's click target is the whole row. | ||
|
|
||
| ## Impact | ||
|
|
||
| - Code: `src/web/ui/app.tsx` (`WorktreeEntry`), `src/web/main/styles.css`. | ||
| - Architecture, wire, upgrade: no change. | ||
| - Tests: `test/e2e/sidebar.spec.ts`. |
37 changes: 37 additions & 0 deletions
37
...080-worktree-term-clicking-anywhere-on-a-sidebar-worktree-row/specs/web/spec.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| ## MODIFIED Requirements | ||
|
|
||
| ### Requirement: Worktree sidebar | ||
| The sidebar SHALL list the selected repo's worktrees in the daemon's order without bare entries, each labelled with its branch, or `<directory name> @ <first 7 digits of head>` when detached, or the directory name when it has no head. On hover a worktree SHALL show its path followed by one line `<preset> <id>: <status>` per terminal, or "no terminals", where the status is `waiting for input` (`state` `input`), `running` (`state` `working`), `done` (`state` `idle` and `unseen`), `idle` (`state` `idle`), `exited`, `exited with code <code>` or `killed by <signal>`, the exit taking precedence. A prunable worktree SHALL be shown greyed and SHALL offer no new terminal. A worktree no longer listed that still has live terminals SHALL be listed after the others, marked as gone, without a checkbox, until its last terminal closes. Each listed worktree SHALL have a checkbox reflecting the daemon's checked state, and toggling it SHALL send `setChecked`. A primary click anywhere in a worktree's row SHALL select it, except on its checkbox, which only toggles it; a right-click SHALL open the worktree menu without selecting. Enter or Space on a worktree's label SHALL select it. Worktree list changes SHALL show without user action. | ||
|
|
||
| #### Scenario: Labels | ||
| - **WHEN** worktrees are on branch `feature/x`, detached at `0123456789…` in directory `wt2`, and bare | ||
| - **THEN** the sidebar shows `feature/x` and `wt2 @ 0123456`, and no bare entry | ||
|
|
||
| #### Scenario: Status on hover | ||
| - **WHEN** a worktree has a terminal `probe` 3 printing continuously and a terminal `probe` 4 that exited with code 1 | ||
| - **THEN** hovering it shows its path, `probe 3: running` and `probe 4: exited with code 1` | ||
|
|
||
| #### Scenario: Vanished worktree keeps its terminals | ||
| - **WHEN** a worktree with a running terminal is removed with `git worktree remove --force` | ||
| - **THEN** it stays listed as gone, its terminal remains usable, and it disappears after the terminal is closed | ||
|
|
||
| #### Scenario: Checkbox shared | ||
| - **WHEN** a worktree is checked in one page | ||
| - **THEN** it shows as checked in another page connected to the same hub | ||
|
|
||
| #### Scenario: The whole row selects | ||
| - **WHEN** the user clicks an unselected worktree's row at its top edge, at its bottom edge, in the space right of its label, or just above its checkbox | ||
| - **THEN** that worktree is selected | ||
|
|
||
| #### Scenario: The checkbox only toggles | ||
| - **WHEN** the user clicks an unselected worktree's checkbox | ||
| - **THEN** the checkbox toggles and the selected worktree does not change | ||
|
|
||
| #### Scenario: Right-click does not select | ||
| - **WHEN** the user right-clicks an unselected worktree's row | ||
| - **THEN** the worktree menu opens and the selected worktree does not change | ||
|
|
||
| #### Scenario: Keyboard selects | ||
| - **WHEN** the user focuses an unselected worktree's label and presses Enter, or another's and presses Space | ||
| - **THEN** that worktree is selected | ||
|
|
19 changes: 19 additions & 0 deletions
19
...-15-dev-2080-worktree-term-clicking-anywhere-on-a-sidebar-worktree-row/tasks.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| ## 1. Corpus | ||
|
|
||
| - [x] 1.1 Archive the merged `worktree-name-search` change in its own commit; `openspec validate --specs --strict` passes | ||
|
|
||
| ## 2. Tests (e2e, `test/e2e/sidebar.spec.ts`) | ||
|
|
||
| - [x] 2.1 The whole row selects: `click({ position })` on an unselected worktree's row at y=1, y=height−2, right of the label, and above the star each select it (assert `aria-selected`); fails before the fix | ||
| - [x] 2.2 The checkbox only toggles: clicking an unselected worktree's checkbox checks it and leaves the selection unchanged | ||
| - [x] 2.3 Right-click does not select: right-clicking an unselected row opens the worktree menu and leaves the selection unchanged | ||
| - [x] 2.4 Keyboard selects: extend `a worktree is selected from the keyboard` to press Enter on one label and Space on another's | ||
|
|
||
| ## 3. Implementation | ||
|
|
||
| - [x] 3.1 `WorktreeEntry` in `src/web/ui/app.tsx`: row `onClick` selects (with the `NOSONAR(S6848)` comment from design.md), the label button has no `onClick`, the star's `onClick` stops propagation; tests 2.1–2.4 pass | ||
| - [x] 3.2 `src/web/main/styles.css`: `cursor: pointer` on `.worktree`, removed from `.worktree .label` | ||
|
|
||
| ## 4. Final gates | ||
|
|
||
| - [x] 4.1 `pnpm test` green (incl. Playwright); `pnpm lint` exits 0; `tsc -b` clean; `openspec validate dev-2080-worktree-term-clicking-anywhere-on-a-sidebar-worktree-row --strict` passes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.