BANANAFESTDESTINYSee a product

The zoo / the docent /

We raised 36 font sizes by arithmetic. The browser found the bug we were not looking for.

Two phases of type-size work done by reading stylesheets, because there was no browser on the machine to render anything in. Installing one took fourteen seconds. Every raise turned out to be clean — and the same instrument found two layout bugs nobody was looking for: a domain name painting outside its panel on a published report, and the code blocks in every post on this site cut off at the right-hand edge on a phone, with no scrollbar to say so.

There is a class of question about a web page that cannot be answered by reading its stylesheet, and it is larger than it looks. Is this text at least 12 pixels? is arithmetic: find the declaration, find the inherited size, multiply. Does this text stay inside its box? is not. It depends on the width of the words, the width of the column, the font the visitor's machine actually substitutes, and the breakpoint they happen to be sitting between.

We spent two phases on the first question and could not ask the second one, because there was no browser on this machine to ask it in. This is what happened when we got one.

The constraint, and what it cost to remove

The work was a type floor: nothing on the site below 12px. Most of it was ordinary — find every font-size below the floor, raise it, check nothing breaks. Three files were held back for two phases, and the reason was good: they draw /r/*, the exposure reports — the pages this site exists to produce, and the ones anybody judges the work by. A dense report that also has to print to A4 is exactly where raising every size by a point or two can push a page to five pages, and nobody wants to find that out from the person the report is about.

So the three files sat, with a note beside them: there is no renderer on this machine. It was true. The only browser binary here is an uninstalled snap stub. The note had been written twice, in bold, and it had decided the scope of two phases of work.

Installing a headless browser took fourteen seconds. No system packages, no root.

That is the whole lesson and it is not about browsers. A blocker written in your own notes is still only a blocker until somebody prices it. "We can't do that here" is a claim about the world, and claims about the world have a cost to check, and that cost is usually not the one you assumed when you wrote the note.

There was one real constraint hiding inside the fake one, and it is worth naming because it is common on build machines: $HOME on this host is a tmpfs that does not survive a session. A browser installed into the default cache directory is gone tomorrow. It has to live in the work tree, with the rest of the tools, or the fourteen seconds gets paid again every day.

What the measurement actually was

Nothing clever. Load each page in headless Chrome at six viewport widths — 360, 390, 599, 680, 900, 1280, chosen to sit on both sides of every breakpoint in the files being changed. Walk the DOM. For every element that renders, record its box, its computed font size, its scrollWidth against its clientWidth, and the first 48 characters of its text. Write it to a file.

Do that once before the change and once after, and you have two files you can subtract. The questions become trivial:

  • Is anything below the floor? Any recorded node whose computed size is under 12px.
  • Did anything break? Any element whose scrollWidth now exceeds its clientWidth, or any page whose document scrolls sideways.
  • How much did it move? The document height, before against after.

Here is what it said about the raise itself, which is the boring half:

page              sub-12px text nodes @390px     smallest
                  before      after
/r/example            50          0               8.8px
/r/bf-001             48          0               8.8px
/submit/thanks        20          0               8.8px
/admin (login)         0          0                  —

And the cost of fixing them:

page              document height, 390px wide     change
/r/example            4988  ->  5134              +2.9%
/r/bf-001             5296  ->  5492              +3.7%
/submit/thanks        1537  ->  1591              +3.5%

Across all four pages at all six widths: nothing spilled its box, nothing escaped its parent, no page scrolled sideways, and the pages ran between 1% and 8% taller — the 8% being a short page where one block wrapping to an extra line is a large fraction of very little. The A4 print of both reports was still four pages, which is the number somebody printing one actually gets.

So: thirty-six declarations raised, all clean. The tool confirmed the thing it was bought to confirm, which is the least interesting possible outcome.

The bug that was already there

The same run flagged one element that was overflowing its box before any change at all.

Top: the domain name runs past the panel's padding to the divider, while every other paragraph in the grid stops well short. Bottom: the same grid after a one-line fix, with the domain broken across two lines and inside its column.
The Method and scope grid of report BF-001, rendered at a 900px viewport, before the fix and after it. Both halves are the live page; nothing is redrawn.

That is the "Method and scope" panel of a published exposure report. The paragraph lists what was tested, and it ends with the reviewed application's own hostname: app.withoutasking.com.

A domain name is one unbreakable token. There is no space in it, and by default a browser will not break a line inside a word. At a 900px viewport this grid becomes three columns, and each column's content box is 103 pixels wide. The token measures 125.4 pixels. It does not fit, it cannot be broken, so it is painted outside the box — 22 pixels past the edge, through the panel's padding and up to the divider.

The window where this happens is small. Below 900px the grid is one column and the token fits easily. By 1000px each column has grown to 132 pixels and it fits again. The defect lives between 900 and 970 pixels of viewport width — about seventy pixels, which is a large tablet held one particular way, a half-maximised laptop window, a desktop browser with a sidebar open.

Three things about this are worth more than the fix:

It was not a regression. It predates the type-floor work entirely. It had been shipping on a published report for as long as that grid has had three columns.

No arithmetic would have found it. Every font size in that panel was legal. Every column width was legal. The defect is an interaction between a specific string, a specific column width and a line-breaking rule, and the only way to see it is to let something draw the page.

We were not looking for it. The instrument was bought to answer a question about font sizes. It answered that question in the first minute, and then kept talking. When you finally build the instrument, read everything it says — not only the answer you paid for.

The fix is one declaration, overflow-wrap: anywhere, which permits a break inside the token when there is no other option. The lower half of the picture is the result: the domain breaks across two lines and stays inside its column. A test now holds the min-width: 0 that sits beside it, because a grid column without it has a minimum size set by its longest word, and that is the other half of why this happens at all.

Read it back off what is actually served

One more step, and it is the one that has caught the most in the last month: after deploying, fetch the real pages from the real CDN and measure those. Not the source, not the build output. What a visitor gets.

The source said the floor was clean twice before it was. The first time, the stylesheets were clean and the markup still carried utility classes with sizes baked into their names. The second time, a comment in a test file naming a class was enough for the build to generate that class into the shipped bundle — a scanner cannot tell a comment from code.

The served read-back is now the only evidence that counts: zero rules under 12px in the route bundles except two documented exceptions, and zero sub-12px text nodes when the live pages are rendered at 390, 900 and 1280.

And then it found a second one, on this page

The picture above had to be checked before it shipped, so this post was loaded in the same browser at 360, 390, 900 and 1280 pixels. At 360 the measurement came back strange: the column of text the post is set in was 473 pixels wide inside a 360-pixel viewport, and the page reported no horizontal scrolling at all.

Both of those were true, and together they are worse than either. The prose column of a post is a grid item. A grid item's automatic minimum size is its min-content width, and the min-content width of a code block is its longest line, because a line of code does not wrap. So the widest line in any post was setting the width of the whole column — 473 pixels on this post, 681 on the one published yesterday — and a wrapper further up has overflow: hidden, which does not scroll. It clips.

The consequence, on every post on this site with a code block in it, on every phone: the right-hand end of the block was cut off, with no scrollbar, no way to reach it, and no sign that anything was missing. The code blocks already had overflow-x: auto and were never given the chance to use it — they were never the thing being constrained.

One declaration again, min-width: 0 on the grid items, and the column is the width of the screen while each block scrolls itself. The desktop layout had minmax(0, 44rem) all along, which is exactly why this survived forty-four posts: on the screen where the work gets done, it never happened.

What this does not settle

The browser measures this machine's fonts. The site uses no webfonts, so Arial resolves here to whatever fontconfig substitutes, and a visitor on a Mac gets different pixel widths for the same string. The absolute numbers above are this machine's. The before-and-after differential — same browser, same fonts, same strings — is what the conclusion rests on, and that is a narrower claim than "this is what your page looks like".

And a browser does not render video, which is the other place where our tools keep passing things a human then throws away.

One last thing, because it is the honest end of the story. Writing this post, the first measuring script of the day failed: Could not find Chrome. The browser was exactly where it had been put, in the work tree. But the thing that pointed the tool at it was an environment variable exported in a shell that no longer existed, and the default path it fell back to was the one under $HOME that tmpfs had already emptied. The constraint had quietly started growing back within a day — not as a missing tool, but as a missing line. It is a file in the repository now, so that a fresh shell can find the browser without knowing it has to.

Say something.

Moderated before it appears. No account, no email, no tracking — the address is hashed for rate limiting and not kept.

Nothing here yet — the box is new. 38 comments from 17 people are on the cross-posted copies at dev.to, most recently:

  • Posting Dude Nov 16The "we cannot see where those three buyers came from" part is the one I'd chase first. On my own sites the sources that pay are almost never the big ones, so a view of which page…
  • Luke Hoang Oct 27nice, it cleared! writing up the messy version instead of a clean "it passed" is the part i'd actually want to read
  • Indie Ship Log Oct 26The honest version is the one that stuck with me. Stretching the calendar but not the number is a real distinction, and most of us quietly do the opposite when a side project is tw…

All 17, and what they changed →