From db69f965d3f781c366e6cd4ecfe94302cfaed900 Mon Sep 17 00:00:00 2001 From: gherkin Date: Wed, 28 Oct 2026 12:00:34 +0100 Subject: [PATCH 1/2] An arrow key in the part list keeps the pin of the part it lands on The arrow keys toggled the pin of the next row. So moving onto a pinned part, or pressing down on the last row, took the pin off and still selected the part. Now an arrow key only pins a part that has no pin. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UCbPYsA5LYNX8HZaGGZCpK --- tests/browser/interaction.spec.js | 32 +++++++++++++++++++++++++++++++ web/app.js | 3 ++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/tests/browser/interaction.spec.js b/tests/browser/interaction.spec.js index 60ee738..491bd55 100644 --- a/tests/browser/interaction.spec.js +++ b/tests/browser/interaction.spec.js @@ -1316,6 +1316,38 @@ test('arrow keys and Enter select a net from the search list', async ({ page }) expect((await state(page)).selectedNet).toBe(net); }); +test('an arrow key onto a pinned part keeps its pin', async ({ page }) => { + await load(page); + await page.locator('#tab-components').click(); + const rows = page.locator('#comp-tbody .comp-row'); + const a = Number(await rows.nth(0).getAttribute('data-idx')); + const b = Number(await rows.nth(1).getAttribute('data-idx')); + await rows.nth(1).click(); + await settle(page); + await rows.nth(0).click(); + await settle(page); + + await page.keyboard.press('ArrowDown'); + await settle(page); + expect((await state(page)).selectedFootprintIdx).toBe(b); + expect(await page.evaluate(([a, b]) => [!!pinnedComponents[a], !!pinnedComponents[b]], [a, b])) + .toEqual([true, true]); +}); + +test('an arrow key past the last part keeps its pin', async ({ page }) => { + await load(page); + await page.locator('#tab-components').click(); + const last = page.locator('#comp-tbody .comp-row').last(); + const z = Number(await last.getAttribute('data-idx')); + await last.click(); + await settle(page); + + await page.keyboard.press('ArrowDown'); + await settle(page); + expect((await state(page)).selectedFootprintIdx).toBe(z); + expect(await page.evaluate((z) => !!pinnedComponents[z], z)).toBe(true); +}); + test('Escape deselects', async ({ page }) => { await load(page); await selectNetFromList(page, frontNets[0]); diff --git a/web/app.js b/web/app.js index 851bdbb..4cc51c7 100644 --- a/web/app.js +++ b/web/app.js @@ -1908,7 +1908,8 @@ function navigateList(tabType, delta) { var next = Math.max(0, Math.min(rows.length - 1, cur < 0 ? (delta > 0 ? 0 : rows.length - 1) : cur + delta)); var row = rows[next]; var idx = parseInt(row.dataset.idx); - togglePinComponent(idx); + // An arrow key is not a click: it pins the part it lands on, never unpins. + if (!pinnedComponents[idx]) togglePinComponent(idx); selectFootprint(idx, false); updateCompListSelection(idx); row.scrollIntoView({ block: "nearest" }); From 4158f2d6b0d0a65c0650420d71160084f2c2f6ec Mon Sep 17 00:00:00 2001 From: gherkin Date: Wed, 28 Oct 2026 12:06:08 +0100 Subject: [PATCH 2/2] navigateList: drop the selection and scroll that selectFootprint already does Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UCbPYsA5LYNX8HZaGGZCpK --- web/app.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/web/app.js b/web/app.js index 4cc51c7..d02d56d 100644 --- a/web/app.js +++ b/web/app.js @@ -1911,8 +1911,6 @@ function navigateList(tabType, delta) { // An arrow key is not a click: it pins the part it lands on, never unpins. if (!pinnedComponents[idx]) togglePinComponent(idx); selectFootprint(idx, false); - updateCompListSelection(idx); - row.scrollIntoView({ block: "nearest" }); } else { // Net panel var netDetail = document.getElementById("net-detail-panel");