v3.28.8: the batch panel's scroll preservation

The attempts box's content is replaced on every render (the batch panel is
static markup; the render fills the dynamic bits) and replacing a
scrollable element's content resets its scroll.  That was harmless while
the render ran once per attempt, but v3.28.7 made it run on every 2 s
poll, so scrolling back through the attempts during a run snapped to the
top each poll.

The render now captures the box's scrollTop before refilling it and
restores it afterwards.

Test: the stub box resets its scroll on an innerHTML write (like a
browser) and the render must keep the reader's position - verified to
fail without the restore.  920 frontend + 928 Python; sw cache
simple-v446.
This commit is contained in:
2026-10-14 23:32:04 +03:00
parent 269e507580
commit 5ae8b1fdd1
5 changed files with 39 additions and 5 deletions
+8 -2
View File
@@ -1910,7 +1910,7 @@
// ===== Version =====
// Single source of truth for the PWA version: shown in the header and used
// by the server version check in pysimConnect().
const SIMPLE_VERSION = '3.28.7';
const SIMPLE_VERSION = '3.28.8';
document.getElementById('app-version').textContent = 'v' + SIMPLE_VERSION;
// ===== view history (the browser Back/Forward buttons) =====
@@ -10267,7 +10267,13 @@ function ramBatchRender() {
counts.textContent = text;
}
const box = document.getElementById('ram-batch-attempts');
if (box) box.innerHTML = ramBatchAttemptsHtml(st.attempts || []);
if (box) {
// Replacing the box's content resets its scroll: the render now runs on
// every 2 s poll, so keep the reader's position (v3.28.8).
const prevScroll = box.scrollTop;
box.innerHTML = ramBatchAttemptsHtml(st.attempts || []);
if (prevScroll) box.scrollTop = prevScroll;
}
}
function ramBatchAttemptsHtml(attempts) {