Skip to content

Shareable walkthrough links - #6

Merged
devmtnaing merged 4 commits into
mainfrom
walkthrough-deep-links
Sep 28, 2026
Merged

devmtnaing merged 4 commits into
mainfrom
walkthrough-deep-links

Conversation

@devmtnaing

Copy link
Copy Markdown
Owner

What this changes

Item 13 from the x-sum UI/UX review. A walkthrough link now reopens at the exact place you were: the approach, step, code language and any input you typed. The change is in src/lib/stepper.js only, so all 46 lessons get it.

/leetcode/x-sum?approach=heap&step=7&lang=python&nums=1,1,2,2,3
/leetcode/valid-palindrome?s=race+a+car

Stacked on #3, #4 and #5. Until those merge, this diff also shows their commits. Merge in order and it shrinks to its own commit.

  • Reading the link: the page reads the query before its first paint. An unknown approach or language, or input that doesn't parse, falls back to the default, and a step past the end goes to the last step. Values left at their defaults stay out of the URL, so an untouched page keeps its plain address.
  • Writing the link: the URL updates with history.replaceState after each step, approach, language or input change, the same pattern the home page uses for its filters. It's debounced by 150 ms, because Safari throws when replaceState is called too often, as it would be during a scrubber drag. It never adds Back-button entries.
  • Opening a shared link scrolls to the player (2·2). A reload, Back, or a link with a #part-… anchor does not.
  • "Report an issue" includes the same state in its page URL, so a report lands on the step it's about.
  • Readable URLs: commas, brackets and colons aren't escaped, and 1, 2, 3 travels as 1,2,3 whenever the field reads it back the same. Free text such as "A man, a plan" keeps its spaces.

Checked

  • npm run check, npm run build, then npm run audit (axe in both themes): passed, 46 pages.
  • A Playwright round trip on every lesson:
    • An untouched page has no query.
    • After switching approach, language, preset and step, the URL and the "Report an issue" link match.
    • Opening that URL in a fresh tab restores the approach, step counter, both language tab rows, the visible Part 3 pane and every field value, and scrolls to the player.
    • Junk parameters (approach=nope&lang=cobol&step=99999, input @@@) fall back to the defaults and clamp the step, with no errors.
    • Result: 46/46 passed, 0 page errors.
  • The keyboard, bad-input, touch-size and narrow-width tests from Stepper keys, screen-reader narration and native dark controls #3–Visible input errors, touch-sized controls, quieter LeetCode links, heading order #5 still pass with nothing new.

- Space on a focused button, link or disclosure presses it instead of
  toggling playback; Alt/Ctrl/Cmd combos go to the browser (Alt+← is Back).
- Approach and language tabs take ←/→/Home/End and use a roving tabindex,
  so only the selected tab is a Tab stop.
- The narration is a polite live region, muted while autoplay runs; the
  scrubber announces "Step 2 of 12: tally" via aria-valuetext.
- tokens.css sets color-scheme per theme, so scrollbars, range tracks and
  spinners are drawn dark on the dark theme.
- The transport and narration stick under the masthead while the reader
  scrolls the stage and code, and let go at the end of the player; not on
  windows shorter than 600px.
- On phones only the buttons stick, as one 40px-tall row; the narration
  stays in the flow above the stage.
- Focusable elements in the stage scroll clear of the sticky bar.
- The array strip wraps onto more rows instead of scrolling sideways, with
  room under each row for pointer labels; cells shrink a little on phones.
…eading order

- A field that does not parse gets a red border, aria-invalid and
  aria-describedby to a live warning; the stage, strip and narration dim
  while any field is bad, and the warning says the walkthrough still shows
  the last input that worked. A valid edit elsewhere no longer clears it.
- On touch screens and at <=560px, chips, language tabs, the page-language
  switch, Copy, example buttons, jump chips, masthead links and the theme
  button are 40px tall.
- The jump nav's "View on LeetCode" links are plain links past a divider,
  not pills like the in-page part chips; the nav is labelled.
- Headings nest without skipping a level (2·2's panels are h4, part 3's
  solutions h3, x-sum's steps h5); .as-h2/.as-h3 keep their old look.
The walkthrough's place lives in the query string: approach, step, code
language and any input the reader typed, e.g.
/leetcode/x-sum?approach=heap&step=7&lang=python&nums=1,1,2,2,3

- Read before the first paint; unknown values fall back to the defaults
  and the step is clamped. Values at their defaults are left out, so an
  untouched page keeps its plain address.
- Written with replaceState after each paint, debounced (Safari throws
  when replaceState is called too often during a scrubber drag).
- Opening a shared link scrolls to the player; reload and Back do not.
- "Report an issue" carries the same state in its page URL.
- Comma lists travel without spaces when the field parses them the same.
@coderabbitai

coderabbitai Bot commented Sep 27, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a81f989e-e990-4921-830f-be575f139a9b


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ d01186c 2026-09-27T02:52:50.850Z Visit the dashboard ↗

@devmtnaing
devmtnaing merged commit 10bc487 into main Sep 28, 2026
52 checks passed
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