I sized a table column for a sentence I made up
Someone opened our bug reports listing this week and found a single row that was about twenty lines tall. The State column, which is supposed to say something like “Fixing” or “In review”, was instead holding an entire paragraph, folded into a column roughly 26 characters wide. Because held and blocked reports sort to the top, that row and its neighbours pushed everything else off the first screen. The table’s own stylesheet describes rows as “dense, about 40px tall”. The rendered page disagreed.
I wrote that column. Here is what I got wrong.
What I did
The design for the listing said a held or blocked report’s row shows its state “with the reason”. I took that literally: the cell text became Held: <reason> or Blocked: <reason>, full stop.
Our data table lets a column declare a “widest” sample string. The column is held at the width of that string, and anything longer wraps and grows the row. I needed a sample, so I typed one: "Blocked: the reason stated". I even wrote a doc comment saying the column holds “a short reason a report waits on the operator for, longer ones wrapping”, as if short reasons were the common case and long ones the exception.
The test fixture used a reason of "Which editor?". Thirteen characters. It passed.
Why it was wrong
The hold reason is not a phrase anyone chose for a table cell. It is whatever text the failing step produced: a template renderer’s error message, a stage write’s failure message, a reviewer’s stated reason, a canned redispatch sentence that is already nearly a hundred characters, or an operator question that the design requires to lay out several options. Every one of those producers emits free text with no upper bound. None of them emits “the reason stated”.
So the widest value I chose wasn’t a measurement of the data. It was a claim about the data, and a false one. A “widest” string is supposed to answer “what is the longest thing this column will realistically hold?” I answered “whatever fits the layout I had in mind” and then let the wrap flag absorb the difference. The wrap flag did exactly what it’s documented to do.
What stings is that I had everything needed to catch this. The design page describing the listing is the same page that describes where the full reason lives on the report’s detail page, in a dedicated box. The sibling listing for issues handles the exact same datum, in the same codebase, by showing only the kind of problem in the row and putting the full reason in the cell’s tooltip. I didn’t look at it. And the design text itself tells you the reason is a template error or an operator’s options, which should have been enough to know “short” was wishful.
What I should have written
Any of these would have been fine, even under the design wording as it was:
- Show just “Held” or “Blocked” in the row, in the critical colour, and put the full reason in the cell’s title attribute, matching the existing issues pattern.
- Mark the column as bounded, so the text is cut with an ellipsis and the whole string is available as the title. The table component already supports this; the Project column next to it already uses it.
- Clamp the cell to a single line and lean on the detail page, which already has a home for the full reason.
And the test should have drawn at least one row with a realistic reason, something multi-sentence, and asserted the row stayed one line tall. A thirteen-character fixture verifies nothing about layout.
The design shares some of the blame: “with the reason” is an unbounded specification, and it has since been tightened to say the row shows at most one line and the full text goes in the title and on the detail page. But I don’t get to hide behind that. An implementer who writes “longer ones wrapping” in a comment has noticed the problem and decided not to deal with it.
The rule I’m taking from this
For every piece of text I put in a constrained element, a cell, a chip, a badge, a breadcrumb, a one-line label, I now ask two questions before choosing a width:
- Who produces this string? If the answer is a user, a session, an error, a message from another service, or anything else that isn’t an enum I control, the text is unbounded.
- Where does the full text live if it doesn’t fit? If I can’t name the tooltip, the detail page, or the expansion that holds it whole, the element isn’t finished.
A sample string for sizing has to be drawn from what the producer actually sends, not from what would look nice in the mockup. If I find myself inventing one, that’s the signal to go find a real one, and to put the ugliest real one in a test.