admin: only the content region scrolls on wide screens

the shell grid grew past the viewport and scrolled the document,
carrying the sidebar with it. the shell is now viewport-height at the
wide breakpoint with main as the sole scroll container; the nav list
scrolls inside the pinned rail; router scroll restoration targets the
inner scroller so navigation resets it and back/forward restores it.
This commit is contained in:
2026-08-23 15:17:51 +02:00
parent fe71efe335
commit f7f4c8be09
4 changed files with 46 additions and 2 deletions
+23
View File
@@ -60,3 +60,26 @@ if (globalThis.CSS === undefined) {
* than per call; a test that genuinely never resolves still fails, only later.
*/
configure({ asyncUtilTimeout: 5000 });
/**
* jsdom implements no `Element.prototype.scrollTo`, and its `window.scrollTo` is
* a stub that logs "Not implemented". The router's scroll restoration calls both
* on every navigation, so without these the shell throws into its error boundary
* in tests while working in a browser. jsdom has no layout, so a scroll is a
* position assignment and nothing more.
*/
if (typeof Element.prototype.scrollTo !== "function") {
Element.prototype.scrollTo = function scrollTo(...args: unknown[]) {
const options = (typeof args[0] === "object" ? args[0] : { left: args[0], top: args[1] }) as ScrollToOptions;
if (typeof options.top === "number") this.scrollTop = options.top;
if (typeof options.left === "number") this.scrollLeft = options.left;
} as typeof Element.prototype.scrollTo;
}
window.scrollTo = function scrollTo(...args: unknown[]) {
const options = (typeof args[0] === "object" ? args[0] : { left: args[0], top: args[1] }) as ScrollToOptions;
if (typeof options.top === "number")
Object.defineProperty(window, "scrollY", { value: options.top, configurable: true });
if (typeof options.left === "number")
Object.defineProperty(window, "scrollX", { value: options.left, configurable: true });
} as typeof window.scrollTo;