A reload offer only for a page that is older, and a tab switch that moves one scroller
The update toast fired whenever a service worker was waiting, so after every release it appeared on pages that were already the release -- including one fetched with Ctrl+Shift+R. It now compares the waiting worker's release with the page's own, and so does the reload that follows another tab accepting it. On Admin -> Prompts, visually hidden labels were positioned against the page and made the document 6771px tall behind an overflow-hidden root; the tab handler's scrollIntoView then scrolled that root and lifted the shell 56px. Every scroll region is now a containing block, and the handler moves only the container that scrolls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -177,6 +177,30 @@ def test_the_tab_reset_finds_the_container_that_actually_scrolls():
|
||||
assert "scrollHeight > " in SOURCE
|
||||
|
||||
|
||||
def test_a_tab_switch_moves_only_the_container_that_scrolls():
|
||||
"""Switching a tab on /admin/prompts lifted the whole shell 56px, with the
|
||||
topbar gone off the top and a strip of bare background under everything.
|
||||
|
||||
Two halves, and either one alone is enough to bring it back. The prompt
|
||||
cards' `.visually-hidden` labels are `position: absolute`. With no
|
||||
positioned ancestor they were placed against the page and stretched the
|
||||
document to 6771px behind an `overflow: hidden` root. And the handler used
|
||||
`scrollIntoView`, which scrolls every ancestor that can scroll, the root
|
||||
included. Measured in headless Chromium at 1640x930 before and after.
|
||||
"""
|
||||
app = (ROOT / "web/static/css/app.css").read_text(encoding="utf-8")
|
||||
start = app.index(".scroll-region,")
|
||||
rule = app[start : app.index("}", start)]
|
||||
assert ".admin-scroll" in rule
|
||||
assert "position: relative" in rule
|
||||
|
||||
code = re.sub(r"/\*.*?\*/", "", SOURCE, flags=re.S)
|
||||
start = code.index('closest(".tabs__bar")')
|
||||
handler = code[start : code.index("})();", start)]
|
||||
assert "scrollIntoView" not in handler
|
||||
assert "outer.scrollTop" in handler
|
||||
|
||||
|
||||
def test_the_two_ends_of_the_shell_stay_level():
|
||||
"""The sidebar footer and the composer sit either side of the same vertical
|
||||
edge and are both content-sized, so without a common floor they end at
|
||||
|
||||
Reference in New Issue
Block a user