Skip to content

Let the sidebar leave an article, not just the Back button - #90

Merged
DanialBeg merged 3 commits into
mainfrom
fix/sidebar-nav-while-reading
Nov 2, 2026
Merged

DanialBeg merged 3 commits into
mainfrom
fix/sidebar-nav-while-reading

Conversation

@DanialBeg

Copy link
Copy Markdown
Member

Reading a checklist article left exactly one way out.

The open article was the Overview tab's own state, so nothing outside it
could close it. Clicking the tab you were already on changes no tab id, so
nothing unmounted and the article stayed up — the sidebar looked live and did
nothing. The breadcrumb was worse: while reading it rendered its tab label as
plain text, because pageLabel was only ever set for a school's page.

The fix

The open article now lives where a school's page already lived — in the URL,
under its tab, held by the module. That gives four ways out where there was
one:

before after
Sidebar, active tab dead closes it
Sidebar, other tab worked worked
Breadcrumb tab label plain text button back to the list
Browser Back nothing to go back to leaves the article
In-page "← Back" worked worked

Covers every module with a sidebar: Application Tracking and College
Essays
through the shared ModuleOverviewTab (its reader is now the
module's state, not its own), and Financial Aid for both Overview and
Scholarships 101.

Financial Aid's scholarship details, fixed differently

Its Aid Tracker and Scholarship Engine detail views had the same dead sidebar.
A detail there is a scored object out of a paginated in-memory list, so an id
in the URL could not rebuild it after a refresh. Instead the module bumps a
counter on every sidebar click and those two tabs close their detail when it
changes — adjusted during render, as the module already does with wasOpen,
which also means a tab opened straight onto a scholarship isn't closed on
arrival.

Tests

  • hashRoute.test.ts — re-picking the tab you are already on must drop the
    open page. That is the whole mechanism, so it is the regression guard.
  • moduleReaderNav.test.tsx — the wiring every module repeats: open an
    article, then leave it from the active tab, from another tab, and with Back.
    Exercises the pattern rather than one module, which would need the full
    provider stack.

Local: tsc clean, eslint clean, 732 tests passing, production build OK.
Also verified in a browser: opening an article sets
#/dashboard/application-tracking/overview/bl-1, the breadcrumb renders the
tab as a BUTTON where it used to be a SPAN, and clicking the already-active
sidebar tab drops the hash and restores the list.

Not covered

No automated test for Financial Aid's two scholarship detail views — rendering
them needs a TrackerApi and the module's provider stack. The counter wiring
is covered by the typechecker and the build only.

Reading a checklist article left exactly one way out. The open article was the
Overview tab's own state, so nothing outside it could close it: clicking the
tab you were already on changes no tab id, nothing unmounted, and the article
stayed up. The sidebar looked live and did nothing. The breadcrumb was worse —
it rendered its tab label as plain text while reading, because pageLabel was
only ever set for a school's page.

The open article now lives where a school's page already lived: in the URL,
under its tab, held by the module. Picking any tab clears it, including the
tab it is already on, so the sidebar works. The breadcrumb names the article
and its tab label becomes a button back to the list. And the article has a
URL, so a refresh keeps it and the browser's Back leaves it. Four ways out
where there was one, all of them the ones a student would try first.

This covers every module with a sidebar: Application Tracking and College
Essays through the shared ModuleOverviewTab, whose reader is now the module's
state rather than its own, and Financial Aid for both Overview and
Scholarships 101.

Financial Aid's two scholarship detail views had the same dead sidebar and are
fixed differently. A detail there is a scored object out of a paginated
in-memory list, so an id in the URL could not rebuild it after a refresh.
Instead the module bumps a counter on every sidebar click and those two tabs
close their detail when it changes — adjusted during render, as the module
already does with `wasOpen`, since starting level with the counter also means
a tab opened straight onto a scholarship is not closed on arrival.

The regression guard is in hashRoute's own tests: re-picking the tab you are
on must drop the open page, which is the whole mechanism. moduleReaderNav
covers the wiring every module repeats — open an article, then leave it from
the active tab, from another tab, and with Back.
@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
webapp Ready Ready Preview Nov 2, 2026 1:32am UTC

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Deploying timeline-prototype with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7816b71
Status: ✅  Deploy successful!
Preview URL: https://94dc6bfd.timeline-prototype.pages.dev
Branch Preview URL: https://fix-sidebar-nav-while-readin.timeline-prototype.pages.dev

View logs

Essays was the only module without the open-transition re-read the other two
have. Now that the open article is module state rather than the tab's, that
meant the module reopened inside the article the student had left, and then
rewrote the URL back to it. The reader used to be ModuleOverviewTab's own
state and unmounted with the shell, so this is a regression the change
introduced rather than one it exposed.

`routedItem` validates that the URL's tab belongs to the module but never
that the item belongs to the tab, and all three modules took whatever was in
the slot. `#/…/scholarships-101/fp-1` rendered an Overview article inside
Scholarships 101's reader, where indexOf is -1, the header reads "0 of 6" and
both prev and next disappear; `#/…/overview/sc-170976` fed a school id to the
article reader. Each module now takes only an id its own tab owns, which also
closes the breadcrumb hole — its back link is gated on a resolved title, so an
unknown id left the dead text this change set out to replace.

The scroll key now carries the open page. ModuleShell resets scroll only when
that key changes, and it was just the tab, so closing a long article from the
sidebar or the breadcrumb revealed the checklist still scrolled to the
article's offset. That is new: the in-page Back sits at the top of the reader,
so the only exit that existed before forced a scroll up first.

Tests: the hashRoute guard asserts the resulting URL as well as the state, or
it would pass with the hash still pointing at the closed article. The reader
harness carries the open transition and a real module-level `valid` array
rather than a fresh literal each render, and covers reopening after a close —
verified to fail without the re-read — and an id the tab does not own.

Left alone deliberately: Aid Tracker could route its open scholarship instead
of using the nav counter, since unlike the Engine's scored object it holds a
bare id. That is a worthwhile follow-up, not a fix to this change.
…n top

#89 restructured the same four files. Application Tracking and Financial Aid
now open on a real Overview and keep their articles in their own tab —
Application 101 and Scholarships 101 — and Financial Aid's Overview no longer
holds a reader at all. That shape is kept whole; this change is re-applied on
top of it rather than beside it.

So the routed article follows the articles: Application Tracking reads it on
`application-101` rather than `overview`, and Financial Aid on
`scholarships-101` only, validated against CHECKLIST_ALL_IDS now that every
article lives there. ModuleOverviewTab keeps #89's `backLabel` alongside the
controlled reader. The two tabs #89 kept remounting with `key={openItem}` keep
the nav counter, since a same-tab click leaves that key unchanged and the
sidebar would still do nothing.

Financial Aid's Overview links into an article with `read101`, which now
routes it instead of seeding a remount, so an article reached that way has the
same exits as any other. That relies on a later setItem winning over the one
setTab clears in the same batch, which was assumption rather than fact, so
hashRoute now tests it.

`tsc --noEmit` does not see the test files; `tsc -b` does, and it is what CI
runs. Four type errors were hiding behind that difference, all of them props
the restructure moved.
@DanialBeg
DanialBeg merged commit 645b02b into main Nov 2, 2026
6 checks passed
DanialBeg added a commit that referenced this pull request Nov 2, 2026
#90 moved the open article into the URL, so the Overview guide's links set
that page instead of the local initialOpenId this branch had added.

This branch was successfully deployed

1 active deployment
Preview — 7816b71d Deployed Nov 2, 2026 by vercel[bot]
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