diff --git a/src/features/vcs/__tests__/multiPushTarget.test.tsx b/src/features/vcs/__tests__/multiPushTarget.test.tsx index 1a7ad7b777..f6d6870bbb 100644 --- a/src/features/vcs/__tests__/multiPushTarget.test.tsx +++ b/src/features/vcs/__tests__/multiPushTarget.test.tsx @@ -392,6 +392,29 @@ it("lists every repository on Push all, checks those with commits, expands none expect(mocks.ops[0]?.repo).toBe("/p/a"); }); +it("selects a repository row to show its files without unticking it; the checkbox or Space includes it", async () => { + await openPushDialog(); + const box = () => screen.getByRole("checkbox", { name: "b" }); + expect(box()).toBeChecked(); + + const name = screen.getByTitle("b"); + fireEvent.mouseDown(name); + fireEvent.click(name); + expect(await screen.findByText("b.txt")).toBeInTheDocument(); + expect(box()).toBeChecked(); + + fireEvent.click(box()); + expect(box()).not.toBeChecked(); + fireEvent.click(box()); + expect(box()).toBeChecked(); + + const tree = screen.getByRole("tree", { name: "Outgoing commits" }); + fireEvent.keyDown(tree, { key: " " }); + expect(box()).not.toBeChecked(); + fireEvent.keyDown(tree, { key: " " }); + expect(box()).toBeChecked(); +}); + it("shows only the repository Push was invoked from without a checkbox, its files shown at once", async () => { render(); await act(() => showPushDialog({ repo: "/p/b" })); diff --git a/src/features/vcs/common.module.css b/src/features/vcs/common.module.css index 27c9ef03aa..5c276272e7 100644 --- a/src/features/vcs/common.module.css +++ b/src/features/vcs/common.module.css @@ -730,9 +730,6 @@ flex: 1; min-width: 0; } -.pushRepoName { - min-width: 20px; -} .pushRepoLabel, .pushSourceBranch { display: block; diff --git a/src/features/vcs/remoteUi.tsx b/src/features/vcs/remoteUi.tsx index f87cae6b7f..fd03a0ed22 100644 --- a/src/features/vcs/remoteUi.tsx +++ b/src/features/vcs/remoteUi.tsx @@ -772,7 +772,17 @@ function MultiPushDialog({ diff={diff} onClose={closeDiff} commits={ -
+
{ + // Space on a selected repository row includes or excludes it, as its checkbox does. + const target = e.target as HTMLElement; + if (e.key !== " " || e.metaKey || e.ctrlKey || e.altKey || only !== undefined) return; + if (!shown || shown.commit || target.closest("input, button, textarea, [contenteditable]")) return; + e.preventDefault(); + toggle(shown.repo.root); + }} + > {loadErrors.map(({ root, message }) => (
{repoName(root)} {message} @@ -826,28 +836,18 @@ function MultiPushDialog({ { - if (only === undefined && !(e.target as HTMLElement | null)?.closest?.("label")) - toggle(n.repo.root); - }} > - {only === undefined ? ( + {/* A row click only selects it (its outgoing files); the checkbox, or Space, includes it. */} + {only === undefined && ( toggle(n.repo.root)} - className={styles.pushRepoName} - label={ - - {repoName(n.repo.root)} - - } + aria-label={repoName(n.repo.root)} /> - ) : ( - - {repoName(n.repo.root)} - )} + + {repoName(n.repo.root)} +