Skip to content

An arrow key in the part list keeps the pin of the part it lands on - #153

Merged
Gherkin merged 2 commits into
mainfrom
arrow-keys-keep-pins
Oct 28, 2026
Merged

Gherkin merged 2 commits into
mainfrom
arrow-keys-keep-pins

Conversation

@Gherkin

@Gherkin Gherkin commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Follow-up to #148 and #149.

The arrow keys in the part list toggled the pin of the row they moved to. Moving onto a pinned part took its pin off but still selected it. Pressing down on the last row did the same to the selected part.

Now an arrow key pins the part it lands on if it has no pin, and never takes a pin off. This is the same check that Enter already uses (activateListSelection).

Tests: two new tests in interaction.spec.js. Both fail without the fix. Full suite: 169 passed. The known flaky test "an inner layer checkbox changes both sides" timed out in the full run and passed alone.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UCbPYsA5LYNX8HZaGGZCpK

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCbPYsA5LYNX8HZaGGZCpK
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-28 11:12 UTC

@Gherkin

Gherkin commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Review round 1

No correctness bugs. The guard at web/app.js:1912 fixes both cases.

Fixing:

  • web/app.js:1914-1915 updateCompListSelection(idx) and row.scrollIntoView repeat what selectFootprint already does (web/app.js:1038, :1088). row is also detached once togglePinComponent rebuilds the list, so the scroll does nothing then. Remove both lines.

Not fixing (FYI):

  • web/app.js:1913 selectFootprint clears selectedBefore, so a part reached by arrow has no "go back" target for a second click. Same as before this PR. Whether arrows should set it is a design choice.
  • web/app.js:1908 arrow at the end of the list still reselects and redraws. An early return when next === cur would skip it, but changes behaviour beyond this fix.
  • web/app.js:1912, :1947 same guard in two places. A pinComponent helper would be cleaner. New structure, so not in this PR.
  • web/app.js:1912 with no pin, togglePinComponent and selectFootprint both rebuild net results and redraw. Also true in activateListSelection. Older code.
  • web/app.js:1910 no hoverClear() before pinning, unlike click (:642) and Enter (:1946). Older code.
  • tests/browser/interaction.spec.js:1319 no ArrowUp-at-first-row test. Same clamp line as the ArrowDown case.

@Gherkin
Gherkin merged commit 6d28f25 into main Oct 28, 2026
10 checks passed
@Gherkin
Gherkin deleted the arrow-keys-keep-pins branch October 28, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant