fuzzyworld

explodorama / commit

What's new dialog: Back keeps the scroll position (0.2.0 work)

e9c64495b72060e47de47ec2d41f7dc8e2b85a08 · Pavel Safronov · 2026-11-01 10:07:30 -0800 · parents b89399da0a40

Claude Code usage: this commit 8.5K out / 2.3M cached · cost unknown (no per-model trailer) · session 8 tally 422 in / 141.2K out / 24.6M cached · usage by commit and session

What's new dialog: Back keeps the scroll position (0.2.0 work)

FW-Tokens-In: 422
FW-Tokens-Out: 141175
FW-Tokens-Cached: 24564666
FW-Session: 59d4e4eb-e946-4c26-9ff4-bea067039a2a
FW-Rtk-Saved: 2799044
FW-Rtk-Cmds: 8123

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
 src/ui/whatsnew.ts | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/ui/whatsnew.ts b/src/ui/whatsnew.ts
index da8b731..636c7ba 100644
--- a/src/ui/whatsnew.ts
+++ b/src/ui/whatsnew.ts
@@ -125,16 +125,29 @@ export function openChanges(releases: Release[] = RELEASES, intro = false): void
 
 let shown = { releases: RELEASES, intro: false }
 
-/** A change's own dialog, its clip above what it does; Back returns to the list (from its top). */
+/** A change's own dialog, its clip above what it does; Back returns to the list, scrolled to where it was (user request, 2026-11-01). */
 function openChange(button: HTMLElement): void {
   const { changeClip, sprite, name } = button.dataset
   const text = [...button.querySelectorAll('p')].map((p) => p.outerHTML).join('')
   const back = shown
+  const body = document.getElementById('dialog-body')!
+  const scrolled = body.scrollTop
   openDialog({
     icon: spriteUrl(sprite!),
     title: name!,
     body: '<canvas class="clip" aria-hidden="true"></canvas>' + text,
-    buttons: [{ label: 'Back', kind: 'plain', onClick: () => openChanges(back.releases, back.intro) }],
+    buttons: [
+      {
+        label: 'Back',
+        kind: 'plain',
+        onClick: () => {
+          openChanges(back.releases, back.intro)
+          body.scrollTop = scrolled
+          // Once laid out, if the dialog wasn't yet.
+          requestAnimationFrame(() => (body.scrollTop = scrolled))
+        },
+      },
+    ],
   })
   startClip(document.querySelector<HTMLCanvasElement>('#dialog-body canvas.clip')!, changeClip as SceneKind)
 }