Repository navigation
test(a11y): give the browser suite the app's stylesheet, and guard hit targets - #716
Merged
Merged
Conversation
…t targets #713 said a pointer-target guard could not be built here, after three attempts failed. The reason turned out to be one line: `test-setup.ts` never imported `globals.css`, so every browser test has been rendering unstyled markup. `text-xs` computed to 16px. `h-9` computed to zero. `px-2` to zero. That is why the earlier sweep measured the title bar's buttons at 33px tall while they were 20px in the app — it was measuring browser defaults, and no assertion about size, spacing or colour made in that suite could have meant anything. Two further things had to be true before the guard was worth writing: - The viewport was 414×896, a phone, for a desktop app. It put the window controls at x=430, off the right edge, where `elementFromPoint` cannot reach them — they measured as -1×-1. Now 1280×800. - The sweep reports how many controls it swept and fails if that is too few. An earlier version of this test lived in AppLayout's browser test, where every child is mocked to a stub; it measured nothing, found nothing, and passed. That is the failure mode this project keeps meeting, and the count assertion is the only thing that catches it. With those fixed, the guard works. Reverting the `min-h-6` from #712 now fails it with the real numbers: Admin Tools is 49×21 Import Data is 49×21 Theme: Dark — click for Light is 30×19 Hit-testing rather than reading the box, because a control can be larger than it looks — the splitters keep a 4px line and widen only the area around them, and reading CSS offsets reports a widened area as passing even when a neighbour paints over it. All 341 browser tests still pass with the stylesheet loaded, so nothing was depending on the absence of styles. jsdom ignores the import, so the unit suite is untouched. Closes #713.
EVWorth
added a commit
that referenced
this pull request
Sep 19, 2026
Expanding a long value showed the title, the character count, the search field and the buttons — and no content. Reported against a 15,573-character `SHOW CREATE TABLE`, and reproducible for any value: the content area was 56px tall, which is its own padding and nothing else. The panel was `max-h-[80vh]`, which is a cap and not a height, so it sized to its content. Its content area is `min-h-0 flex-1`, and inside that sits Monaco, which is absolutely positioned and reports no intrinsic height. Every one of those is individually reasonable and together they leave nothing holding the box open. `min-h-0` is the part worth understanding. A flex item's automatic minimum size is its content, which is what normally stops a `flex-basis: 0` item collapsing; `min-h-0` switches that off. It is the right thing to write when the parent has a definite height and you want the child to scroll — which is what Monaco needs — and it is fatal when the parent does not. The two other flex-column panels in the app use `flex-1` without `min-h-0`, so their automatic minimum still holds them open. This one had disabled its own safety net. So the panel gets a definite `h-[80vh]`. The viewer is a place to read a value rather than a message box, a consistent size suits it, and the failure mode cannot recur. This is #217 again, fixed once in #220 at a nested wrapper. That wrapper was real and removing it was right, but it was not why the box was empty, and the bug came back. The test measures the box rather than Monaco, because Monaco loads asynchronously and may never mount in a harness, while the box it would be given is already decided by CSS. It only means anything because the browser suite loads the app's stylesheet as of #716 — before that every element measured zero and this test would have passed against nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #713.
The browser suite has never loaded the app's CSS
#713 concluded a pointer-target guard couldn't be built here, after three
attempts failed. The reason turned out to be one missing import:
test-setup.tsnever loadedglobals.css.Probed directly:
Every one of the 340 browser tests has been rendering unstyled markup. That
is why my earlier sweep measured the title bar's buttons at 33px while they
were 20px in the app — it was measuring browser defaults. No assertion about
size, spacing or colour made in that suite could have meant anything.
All 341 pass with the stylesheet loaded, so nothing was depending on its
absence. jsdom ignores the import, so the unit suite is untouched.
Two more things the guard needed
The viewport was 414×896 — a phone, for a desktop app. It put the window
controls at x=430, off the right edge, where
elementFromPointcan't reachthem; they measured as
-1×-1. Now 1280×800.The sweep reports how much it swept, and fails if that's too few. The first
version of this test lived in AppLayout's browser test, where every child is
mocked to a stub — it measured nothing, found nothing, and passed. That's the
failure mode this project keeps meeting, and the count assertion is the only
thing that catches it.
It can fail
Reverting #712's
min-h-6:Hit-testing rather than reading the box, because a control can be larger than
it looks — the splitters keep a 4px line and widen only the area around them,
and reading CSS offsets reports a widened area as passing even when a neighbour
paints over it.
What this opens up
With styles loaded and a real viewport, the browser suite can now assert things
it never could: computed colour, spacing, and geometry. The sweep here covers
the title bar; extending it to the full layout needs the unmocked-AppLayout
fixture #713 describes, which is still worth having.
🤖 Generated with Claude Code