A phone, and how much of this could not be used on one
The sidebar was a 280px panel laid over the page below the phone breakpoint, opened from first paint, with the only control that closed it underneath it -- and that control existed on /chat and on none of the seven other pages carrying a sidebar, Settings included. It starts closed at that width now, slides, dims the page behind it, and closes by tapping beside it, by Escape, or by its own button, which is inside the drawer where it can be reached. Everything a finger has to hit was 36px, or 28 for renaming a chat, every action on a message and every panel's close button. Raising --control-h under a coarse pointer is the only fix that reaches all forty of them, which is what that token is for. The row and message actions were also hover-only, so on a phone they did not exist at all. Installing: the splash and the browser chrome follow the instance's theme rather than always being Moria's near-black; there are screenshots, so the install offer is a dialog rather than a one-line bar; a new release no longer takes over a page somebody is reading; the notification badge is a silhouette rather than a grey square; and a browser rotating its own subscription no longer ends notifications for good. Every request now says it is happening -- nothing did before, so anything slower than a few milliseconds looked like a click that had not registered. A chat can be archived. The column has been filtered on in four places since folders arrived and written by nothing, which is what made it look built. chat.css may contain media queries. The ban protected the composer toolbar from being "fixed" with a breakpoint; that guarantee is asserted directly now, and the old test would have passed a version of the file that wrapped the toolbar without one. scripts/shoot.py is the instrument all of this was found with: it renders a page through TestClient into a real headless browser at a real size and refuses to run if an asset URL was left pointing at testserver. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -72,3 +72,50 @@ def test_the_canvas_starts_wider_than_the_terminal():
|
||||
for name in PANELS
|
||||
}
|
||||
assert widths["--canvas-width"] > widths["--terminal-width"]
|
||||
|
||||
|
||||
# --- Breakpoints -------------------------------------------------------------
|
||||
# A media query cannot read a custom property, so the three widths this
|
||||
# application breaks at are literals in three stylesheets with nothing tying
|
||||
# them to the tokens that name them. Which is fine until somebody adds a fourth
|
||||
# in passing, and then there are four breakpoints and a comment describing
|
||||
# three.
|
||||
def _breakpoints_used() -> set[str]:
|
||||
"""Widths that appear in an `@media` condition, and nowhere else.
|
||||
|
||||
Scoped to the condition on purpose: `max-width` is also an ordinary
|
||||
declaration -- `.composer__dir` is capped at 11rem, `.picker__menu` at
|
||||
14rem -- and a pattern that reads every one of them calls two dozen
|
||||
component caps "breakpoints" and fails on all of them.
|
||||
"""
|
||||
import re
|
||||
|
||||
used: set[str] = set()
|
||||
for name in ("app.css", "chat.css", "admin.css"):
|
||||
text = (ROOT / "web/static/css" / name).read_text(encoding="utf-8")
|
||||
for condition in re.findall(r"@media([^{]*)\{", text):
|
||||
used.update(re.findall(r"max-width:\s*([\d.]+rem)", condition))
|
||||
return used
|
||||
|
||||
|
||||
def test_every_breakpoint_is_one_of_the_declared_ones():
|
||||
import re
|
||||
|
||||
declared = set(re.findall(r"--bp-[a-z]+:\s*([\d.]+rem)", TOKENS))
|
||||
assert declared, "no --bp-* tokens declared"
|
||||
|
||||
used = _breakpoints_used()
|
||||
assert used <= declared, (
|
||||
f"breakpoints used but not declared in tokens.css: {sorted(used - declared)}"
|
||||
)
|
||||
|
||||
|
||||
def test_no_breakpoint_is_declared_and_never_used():
|
||||
"""The other direction: a token naming a width nothing breaks at is the
|
||||
same clutter as a colour nothing paints with."""
|
||||
import re
|
||||
|
||||
declared = set(re.findall(r"--bp-[a-z]+:\s*([\d.]+rem)", TOKENS))
|
||||
assert declared <= _breakpoints_used(), (
|
||||
f"declared and unused: {sorted(declared - _breakpoints_used())}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user