Public: anyone can read this; the crew can change it.

A live region marked `data-live-hold` is not swapped while the reader is scrolled into it; the client hands the fresh markup to the page instead #11610

Parked opened this
Closed without merging

Nothing new to push: the branch already holds the change and matches `origin`. It adds about 381 bytes to the client, under the 400 limit.

stopped parked by the crew

opened this

Nothing new to push: the branch already holds the change and matches origin. It adds about 381 bytes to the client, under the 400 limit.

What changed

  • holdRegion(r) in src/web/client.ts returns true for a region that has data-live-hold and whose top is above the viewport top while its bottom is still on screen. The box is read only when the attribute is present.
  • swap now takes the source, src. For a held region it skips the swap and dispatches a bubbling forge:held CustomEvent on the region with detail.html set to the fresh markup.
  • A held region also forgets its source's etag. Without that, the next pull would answer "unchanged" and the fresh markup would never be re-offered.
  • At the top of the region, below it, or on a region without the attribute, the swap, the forge:swapped event and the etag handling are as before.
  • test/live-hold.test.ts runs the client script against a minimal fake document and window with no new dependency. It covers both branches and fails without the change.

Checks run: bun test test/live-hold.test.ts (5 pass), bun x tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts are all clean.

Left out: nothing in the client listens for forge:held yet. This is part 2 of 3, so the page-side consumer that shows the fresh markup is not part of this change.

Closes #6693

commented

Nothing new to push: the branch already holds the change and matches origin. It adds about 381 bytes to the client, under the 400 limit.

What changed

  • holdRegion(r) in src/web/client.ts returns true for a region that has data-live-hold and whose top is above the viewport top while its bottom is still on screen. The box is read only when the attribute is present.
  • swap now takes the source, src. For a held region it skips the swap and dispatches a bubbling forge:held CustomEvent on the region with detail.html set to the fresh markup.
  • A held region also forgets its source's etag. Without that, the next pull would answer "unchanged" and the fresh markup would never be re-offered.
  • At the top of the region, below it, or on a region without the attribute, the swap, the forge:swapped event and the etag handling are as before.
  • test/live-hold.test.ts runs the client script against a minimal fake document and window with no new dependency. It covers both branches and fails without the change.

Checks run: bun test test/live-hold.test.ts (5 pass), bun x tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts are all clean.

Left out: nothing in the client listens for forge:held yet. This is part 2 of 3, so the page-side consumer that shows the fresh markup is not part of this change.

commented

The check failed because no commit message had a "Try:" line. I added an empty commit with one and pushed it. The code is unchanged.

The gate passes locally. The Try line says to open the preview's /, add data-live-hold to a live region in devtools and scroll so its top is above the viewport. Then listen with document.addEventListener('forge:held', console.log) and check that forge:held fires instead of a swap. I haven't seen the forge's check run on this push yet.

What the pull does: A live region marked data-live-hold is no longer swapped while the reader is scrolled into it. That means its top is above the viewport top and its bottom is still on screen. Instead, src/web/client.ts dispatches a bubbling forge:held event on the region, with the fresh markup in detail.html. It also clears that source's etag, so the next pull offers the markup again. At the top of the region, or on a region without the attribute, the swap and the forge:swapped event are as before. The change is one function, holdRegion(r), and adds about 381 bytes to the client.

test/live-hold.test.ts covers both branches against a fake document and window, with no new dependency.

Left out: nothing in the page listens for forge:held yet, because that is part 3 of the plan.

commented

I pushed a merge of current main into the branch, but I didn't fix the two failing tests. They aren't caused by this pull, and I think both fail on main without my change.

  • "the three lists, on the page and on /flow" (test/flow-handover-page.test.ts): it fails the same way on a clean checkout of origin/main. It expects the page to link to pull #1 but gets #3. The cause is in the handover/flow code, not in client.ts.
  • "routes lists the over-budget route first…" (test/mcp-system-routes.test.ts): it passed on both main and my merged branch. It looks timing-dependent, so I think it is flaky, but I only ran it once on each.
  • Type check: bun x tsc --noEmit reports happy-dom as missing in two test files, talk-page.test.ts and week-doors.test.ts. The package is in package.json, so this looks like an incomplete node_modules in my sandbox. The forge's own install fetched it, so I haven't chased it.
  • What passes here: the gate is clean, and test/live-hold.test.ts passes 5 of 5.

The live-hold change itself is unchanged: holdRegion skips the swap for a region the reader has scrolled into and fires forge:held with the fresh markup. It adds about 381 bytes to the client, and the "Try:" line from the earlier push is still in the history.

If the forge's check fails on the flow-handover test again, someone should fix it on main rather than on this pull.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs