Skip to content

rules: the index marks the last law at the bottom and a clicked law at once - #29

Merged
Lindeneg merged 6 commits into
masterfrom
LTET-29-rules-index-last-law
Nov 7, 2026
Merged

Lindeneg merged 6 commits into
masterfrom
LTET-29-rules-index-last-law

Conversation

@Lindeneg

@Lindeneg Lindeneg commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Closes LTET-29

On the Rules page the index never marked the photo credits: the last section is too short to scroll to the top of the window, so the first law in view stayed Honours, even after clicking Photo credits.

At the bottom of the page the index now marks the last law, worked out on scroll one frame at a time. Everywhere else it marks the first law in view, as before. A page too short to scroll keeps the old behaviour.

Tested: unit tests for the bottom of the page, scrolling back up and a short page. In a real browser on the live Rules page with this script, Photo credits is marked at the bottom and after clicking it (Honours before).

Comment thread public/rules.js Resolved
@claude

claude Bot commented Nov 7, 2026

Copy link
Copy Markdown

review: 6b95fea
findings: 2

  • [should-fix] public/rules.js:20: the click mark is overwritten during the smooth scroll, because each scroll frame calls update(), which re-marks the first law in view. Clicking a later law flickers through the laws it passes, and it reverts if the clicked law is not the first one intersecting when the scroll settles. Fix: hold the clicked law until the scroll settles (scrollend or a short timeout) or the user scrolls on their own.
  • [should-fix] tests/unit/client/rules.test.ts:57: the click test only checks the mark immediately after the click. It never checks that the mark survives a following scroll event or observer callback while an earlier law is still in view. Fix: after the click, dispatch a scroll event and an observer callback with an earlier law intersecting, and assert the clicked law stays marked.

Comment thread public/rules.js Resolved
@claude

claude Bot commented Nov 7, 2026

Copy link
Copy Markdown

review: e128ea0
findings: 1

  • [should-fix] public/rules.js:20: the click mark is overwritten by the new per-frame scroll update() during the smooth scroll (clicking "table" from the top flickers through earlier laws; clicking a middle law near the page bottom marks the last law), and no test covers it. Fix: suppress update() until the click-initiated scroll ends (scrollend or a short timeout) and add a test for it.

Comment thread public/rules.js Resolved
@claude

claude Bot commented Nov 7, 2026

Copy link
Copy Markdown

review: ee43a34
findings: 1

  • [should-fix] public/rules.js:47: the hold timer is never cleared, so clicking law A then law B within 1.5 s lets A's timeout release B's hold mid-scroll and the index flips to the wrong law. Fix: store the timer id, clear it in hold and release, and add a two-quick-clicks test.

Comment thread public/rules.js Resolved
@claude

claude Bot commented Nov 7, 2026

Copy link
Copy Markdown

review: b9c1c92
findings: 1

  • [should-fix] public/rules.js:47: clicking law A then law B within 1.5s lets A's leftover timer or scrollend listener release B's hold, so the mark jumps off B mid-scroll. Fix: keep a single timer id and listener and clear them at the start of hold.

Comment thread public/rules.js Resolved
@claude

claude Bot commented Nov 7, 2026

Copy link
Copy Markdown

review: 6de5c42
findings: 1

  • [should-fix] public/rules.js:43: after a clicked law's scroll ends, release does not re-sync the index. Clicking a law whose scroll clamps at the page bottom, or one with an earlier section still in view, leaves the clicked law marked until the next scroll. Fix: call update() after held is cleared in release, and add a test for a click that ends at the bottom.

@claude

claude Bot commented Nov 7, 2026

Copy link
Copy Markdown

review: e7a111a
no findings

@Lindeneg
Lindeneg merged commit de7d3be into master Nov 7, 2026
4 checks passed
@Lindeneg
Lindeneg deleted the LTET-29-rules-index-last-law branch November 7, 2026 00:32
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