Skip to content

Lay out tables, the matrix, the CFG panes and long text for every screen width and text size - #337

Open
r0ny123 wants to merge 27 commits into
ref/integrate-all-20261025from
fix/web-layout
Open

r0ny123 wants to merge 27 commits into
ref/integrate-all-20261025from
fix/web-layout

Conversation

@r0ny123

@r0ny123 r0ny123 commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Based on ref/integrate-all-20261025, the build of all open PRs (#316's comment has the order), so the diff here is this change alone. One of a set of PRs from a review of the front end against the modern-web-guidance layout and performance guides; the others are #328 and #330-#336. Checked in Chromium on 22 pages at 320, 390, 768, 1024 and 1280 px, in both themes, scrolling through each: no layout shift, no console error, and no page wider than the window. The one exception is the cross-compare page, which is wide because of its tooltips; #334 fixes that.

Tables

  • 0eaeb94: below 1200 px a wide data table scrolls in its own box (.table-scroll), instead of the whole page scrolling sideways. The Analyze and user menus in the last rows are not clipped by the box.
  • c9de7a5: from 1200 px, a long table's headings stay in view.
  • e2ca49d: a box with more table to its right fades at that edge. So does the cross-compare matrix.
  • 1f65ca8, 52162a8: long values (hashes, tokens, file names) break inside the field tables that do not scroll.
    • Label cells stay at least 14ch wide and values 10ch, so "Username:" no longer breaks after its "n".
    • The two side-by-side comparison tables scroll in their box.
  • b6ec8a8, 65f37a8 (performance review P5): a result page's function-match tables are laid out only as they come near (content-visibility: auto), sized to what their rows measure.
    • The estimate is N × (2.35rem + 1px) + 3rem, within 0.5% at 320-1199 px, so the scrollbar does not jump.
    • The #function-matches anchor still lands on its heading, and the keyboard reaches into a table not yet laid out.
    • Without support, it lays out at once, as before.

Text

  • ff6be11: long unbroken tokens in headings, notices and empty-table messages, such as a searched hash, break instead of widening the page. The section.content h1 rule matched nothing (the page is main) and is gone.
  • cae978b: pages follow the reader's system text size.
    • The opt-in meta is in place.
    • px font sizes in the tooltip, the cross matrix and the login page are now rem.
    • The copy button has a minimum size.
  • dcd3d55: the font is set in style.css. An inline font-family on <body> was overriding html { font-family: 'Roboto' }.
  • 53007d0, 5db1670: the manual's lines are at most 80 characters, about 190 before. Its screenshots stay the width of the page (:not(:has(> img))).

The cross-compare matrix and the CFG panes

  • f15bd4c: the matrix is centred by its margins. With justify-content: center its left columns could not be scrolled to.
  • 5ae5159: on a phone the CFG panes stack, instead of two 147 px columns, and 100vh became svh.
  • f1edd6f: in a short window the "loading graph" and error notes sit inside their pane, instead of 400 px down.

Inline styles (98d167e, e86947d, 5bdb4a5)

  • Replaced by classes:
    • 104 inline text-align styles by text-end and text-center;
    • 33 status colours by .status-yes and .status-no;
    • 14 settings flex rows by .settings-columns.
  • Before and after, the computed colour, alignment, display and box of every cell, icon and block on 22 pages, at 390 and 1280 px in both themes, are identical.
  • tests/testInlineStyles.py fails if one comes back.

Since review was requested.

Tests. Each fix has a test that fails on its parent commit:

  • new: testTableScrollBrowser.py (10 pages at 320-1024 px, shifts asserted 0), testCfgPaneLayout.py and its browser twin, testTextScale.py, testTypographyBrowser.py and testInlineStyles.py;
  • extended: testTableLayout.py, testJobDescriptionWrapping.py and testManual.py;
  • f916aee brings three existing tests in line;
  • testTableScrollBrowser.py presses Show token on the settings page before it measures the token (ec1c0fa).

56 related test files pass (1984 tests), and ruff is clean.

One run of testTableScrollBrowser.py failed its cross-compare case once. It passed in every other run, including three at -n 4, and could not be reproduced. It goes into the combined suite run before merging.

Lighthouse 13.5.0, one run each:

page mobile Perf desktop Perf A11y / BP / SEO CLS
result (sample) 99 100 100 0
result (cross compare) 99 100 100 0
function page, manual, samples, sample, settings 100 100 100 0

The sample result page's mobile 99 is load. Alternating with the base, 7 runs each, this branch scored 99/99/99/100/100/100/100 and the base 99/100/100/99/99/100/99. Unthrottled, median first paint was 186 ms against 222 ms. The cross-compare 99 was not re-run; that page and all others get a run on a quiet machine, recorded in the merge-order comment on #316.

Merge notes.

A data table is as wide as the headings, ids, families and buttons it
keeps on one line (issue #52), up to 1,064px on the samples list, and no
table had a scroll container: below about 1,100px the whole page
scrolled sideways, heading, filters and pagination with it.

Each data table now sits in a .table-scroll box that scrolls it on its
own below 1200px, and is positioned so that it also clips Bootstrap's
.visually-hidden text. Above that the tables fit, and the box stays out
of the way of the rows' hover tooltips. The table's bottom margin moves
to the box, so the spacing below a table is unchanged.

A box that scrolls sideways clips at its bottom too, which cut off the
Analyze menu of the last sample in a short table and the actions of the
last user. static/table_scroll.js creates those dropdowns with Popper's
fixed strategy before Bootstrap's handler sees the first press.

The tables that list the fields of one thing stay out of the boxes; a
lint in testTableLayout.py names them.
The tables that list the fields of one thing (a sample's, a function's,
a job's, the account settings) are not in a scroll box, and a long
unbreakable value had nowhere to go: the 64-character API token made the
settings page 641px wide at 390px, and a result page's reference sample
table was 429px in a 358px column.

A Bootstrap table outside a .table-scroll now breaks its cells' long
values with overflow-wrap: anywhere, which, unlike break-word, also
lets the table's narrowest width give up the token.

The browser test now counts layout shifts from the moment the document
is parsed and refuses the icon fonts: under a parallel run the test's
own server can be slow enough for the browser to paint a half-parsed
page, or to get a font after the first paint, on master as well.
A page shows up to 250 rows, and after one screen of a score table the
reader could no longer tell the Direct column from the Frequency one:
nothing kept the column headings in view.

From 1200px, where the table's box does not scroll and so is not what a
sticky element would stick to, the headings of a boxed data table are
sticky at the top of the window. The light head's cells already carry
Bootstrap's opaque background; any other head gets the page's, so the
rows passing under it do not show through. Below 1200px the box scrolls
and the headings stay as they were.
The matrix panes were d-flex justify-content-center overflow-auto. Once
the matrix is wider than its pane, centring pushes its start to the left
of the pane, where a scroll position cannot go: at 390px the index, the
hash and the copy button of every row were cut off by 56px, and a
40-sample matrix lost about 126px on a desktop.

The panes are plain blocks now and the matrix is centred by auto
margins, which centre what fits and fall to 0 for what does not, so the
pane scrolls from the first column. The tabs filled in the browser
append their matrix to the same pane and get the same.
Nothing said that a table or the cross compare matrix scrolled
sideways: a touch scrollbar, and a Mac's, stays hidden until the table
is touched, and a table cut at the edge of a phone looks whole.

Where scroll-state container queries are supported, a box that scrolls
(.table-scroll below 1200px, and the matrix pane) is a grid of one cell
holding the table and a fade, which sticks to the box's right edge and
shows while scroll-state(scrollable: inline-end) holds. The fade takes
no room and catches no press, so the tables' geometry is unchanged at
390, 768, 1024 and 1280px on every list and result page, and showing
it moves nothing. It is hidden in forced colours, which would replace
the page colour it fades to. Elsewhere there is no fade, as before.
With 250 rows a page, the tables of a sample's result are 20,000
elements, all laid out before the page is first shown. Below 1200px the
function matches, the last and longest table, now sit in a box with
content-visibility: auto, held at an estimate the template works out
from the row count (2.45rem a row, 3.75rem for the headings), which was
within 1.5% of the laid-out height at 390, 768 and 1024px.

Measured at 390px with the rows inflated to 250, eleven runs each at 4x
CPU: layout 2,688 to 989 ms, style 1,838 to 774 ms, main-thread task
time 6.6 to 3.9 s, the document parsed 2.2 s earlier; first paint and
CLS unchanged (CLS 0 while scrolling through the page).

Not from 1200px, where the box does not scroll so that the headings can
stick: content-visibility clips like a scroll container, and a table
wider than the window would be cut off there. Not the tables above the
function matches either: the samples or families matched are near the
top and laid out anyway, and a library match's version wraps in a
narrow column, so no row estimate would hold for that table.
The rule that lets a heading break a long token was scoped to
section.content h1, and the content region is <main class="content">:
it matched nothing, and the test that read it back passed regardless.
Searching for a SHA-256 made the page 1,434px wide at 1280px, from the
heading quoting the term and the notice the search flashes; an empty
list echoing the term made it 523px at 390px; a long family name did
the same in its page's heading.

All headings, flashed notices and the empty-table message (which now
carries an empty-state class) break a token that does not fit with
overflow-wrap: anywhere. The test checks that each overflow-wrap rule
names something the templates render, which the old selector fails.
trace_CFG/cfg_style.css floats the graph and its code, or the two graphs
of a comparison, side by side at 50% each at every width, as tall as
the window less the 106px above them in vh. At 390px that was two 147px
panes: the graph a speck and the code cut after about twenty characters.

style.css stacks the panes below 768px, each the full width of its
column and 70svh tall, and sizes them in svh at every width: 100vh is
the window without a phone browser's bars, so the bottom of a pane hid
behind them while they showed, and dvh would resize the panes, and move
what is below them, as the bars come and go. The combined view's pane
gets the same unit. `main` makes the overrides outweigh the vendored
id rules, which are linked after style.css.
The "Loading" note of the function page's graph and the comparison
page's notes, the combined graph's error among them, were placed with
an inline margin-top: 400px, in panes as tall as the window less 106px
and overflow: hidden. On a landscape phone (844x390) the pane is 284px
and the note was 116px below its bottom, so neither the progress note
nor the error ever showed.

The five notes share a graph-note class, whose top margin is the
smaller of 400px and about half the pane's height; the error keeps its
own colour.
The manual's paragraphs and list items filled the whole container:
about 171 characters a line at 1280px and 199 at 1920px, where the
modern-web-guidance typography guide asks for at most 80. Its
paragraphs, list items, quotes and definitions are now at most 80ch
wide; its pictures, tables and code keep the full width.
Android and ChromeOS let a reader set a text size for the whole system,
and Chrome and Edge apply it to a page that opts in with
<meta name="text-scale" content="scale">, by scaling the root font size.
No page opted in, and what was sized in px would not have followed: the
cross compare matrix's labels (13px) and column index (10px), hint.css's
tooltips (12px on a 12px line) and the login fields (16px). The copy
button had a 24px maximum, which clipped the 28px icon of a doubled
text size.

base.html opts in, after the viewport meta. The matrix sizes move from
fourteen inline styles to a cross-matrix class in style.css, in rem;
the id and hash cells keep their classes, and the matrix measures the
same as before at the default size. The tooltips get 0.75rem on a line
of 1, which looks as before, from style.css with :root to outweigh the
vendored sheet; the login fields 1rem. The copy button has a minimum
of 24px instead of a maximum, the size WCAG 2.5.8 asks of a target. No
project stylesheet sets the root font size.
<body style="font-family: sans-serif"> outweighed both style.css's
html { font-family: 'Roboto', sans-serif }, which never applied (no
text font is shipped, and Bootstrap sets the font on body), and
Bootstrap's system-ui stack. The pages were set in the generic
sans-serif from an inline style that nothing in the stylesheets
mentioned.

The style attribute is gone and style.css's body rule sets the same
sans-serif, so the pages look as before; the Roboto declaration, which
promised a font that never loaded, is removed.
The box of a result's function matches waits at an estimate until it
comes near the window, and the page's scrollbar moves by whatever the
estimate got wrong when it is laid out. 2.45rem a row was 0.6px a row
too tall: 59px of 3,921 for a hundred rows, 1.5%, and 150px at 250.

A row measures 2.35rem and a 1px border at every width, and the headings
38px on one line or 60px on two; the estimate is now that, with 3rem
for the headings, within half a percent of the table at 320, 390, 768,
1024 and 1199px. The new test fails on the old numbers.
style="text-align: right;" stood on 94 cells and style="text-align:
center;" on ten more, in nine templates: a column's alignment was a
separate edit in each of them.

They are Bootstrap's text-end and text-center, which are in the cut
subset already. Every td, th, i, div and span on 22 pages, at 390 and
1280px in both themes, has the same computed colour, alignment, display
and box as before. The sortable headers' text-align: {{ align }}, which
the caller chooses, is left as it is.
style="color: var(--status-yes)" stood on 17 icons and --status-no on
16 more and two messages, each a place to change a colour, and a colour
that theme-dark.css could only have outweighed with !important.

style.css has .status-yes and .status-no, which take the same two
tokens, and the elements carry them. The computed colours and boxes of
the cells, icons and notes on 22 pages, at 390 and 1280px in both
themes, are the same as before.
The fourteen Active and Available rows of the settings page each said
display: flex; justify-content: space-between; in a style attribute,
on a Bootstrap .row that is a flex box already.

They carry a settings-columns class, which says the spacing once. The
page's boxes, at 390 and 1280px in both themes, are the same as before.
The samples page queues table_scroll.js now, which the queue test
listed without; the graph notes carry a second class where the error
note is red; and the colour scan's floors for style attributes and
declarations, set at a third of what it first saw, are below what the
templates hold now that classes say the alignment, the status colours
and the matrix's sizes. The floors are a quarter of what it first saw.
Each screenshot in the manual sits in a paragraph of its own, and the
paragraph held to 80 characters held its picture to it: the twenty
screenshots were 640px of a 1,116px column at 1280px, their lettering
too small to read, and the page 2,100px shorter than it was.

A paragraph that holds a picture is left out of the limit. The new
browser test fails without it, and the line-length test no longer
counts the picture paragraphs.
Letting a table break a long value anywhere sizes it from one letter a
cell, and the label column was squeezed until "Username:" broke after
the n and "Instructions:" after the Ins, on the settings page, a sample's
and a function's, and the result pages' reference samples at 390px.

A label cell is at least 14ch wide and a value cell 10ch, enough for the
longest word of a label and for a number of eight digits; the long
values give up the width instead. Two tables put samples or functions
side by side and still have too little room at 320px, with their
headings that do not wrap: they are in a box that scrolls them there,
and break a long value in it as well. No word of 13 characters or fewer
is cut across two lines, and no page is wider than its window, at 320,
390 and 768px on seven pages; the browser test fails without the change.
The test looked for style="color: var(--status-yes)" on the flask icon to
tell a badge from a plain Analyze button. The icon now carries the
status-yes class instead, so the test found no badge on any row. It now
looks for that class on the icon, which still separates the two buttons.
The function details tables sit in a .table-scroll, which is positioned. On
the function comparison page a floated API usage button comes before that
box; the table keeps clear of a float, but the block around it ran under the
button and, being positioned, painted over it and took its clicks, so the
dialog never opened. The box is now display: flow-root, as it already was
where it scrolls. A browser test clicks the button on both function pages.
The lint fails any overflow-wrap: anywhere rule that names nothing a template renders. An element a script builds, such as a message made by a static script, has its class and tag in that script and in no template, so the rule for it was reported as matching nothing. The lint now also counts the classes and tags the project's own scripts give the elements they create.
The tooltip rule kept hint.css's single-line height of 1, which sets the lines of a tooltip that wraps on top of each other. It is now 1.4, still unitless so it scales with the text. The test that read the rule took the first :root [data-hint]::after rule of the stylesheet; it now picks the one rule that sets the font size, so another rule on the same selector cannot hide it, and asks for a unitless line height of at least 1.3.
A scroll-state container on .cross-pane-body, which the edge fade used to
know whether the pane scrolls, added about 190ms of style time to every tab
switch of a 100 x 100 matrix (602ms against 418ms). The pane is no longer a
container: its fade is a scroll-driven animation of its own opacity, shown
for the whole scroll range and gone at the end, and a pane that does not
scroll has no timeline and keeps the fade hidden. Boxes of ordinary tables
keep the container query, which costs nothing on a table that small. Where
scroll-driven animations are not supported there is no fade, as before.
Without hard links the key was written into a file created with O_EXCL,
empty until filled. A worker that opened that file in the gap could
replace it and find the creator's key still written into the file it
had displaced; a third worker that had opened the displaced file before
the replacement then read the loser's key and used it, while everyone
else used the winner's. One round in about 1600 ended that way.

The staged key, complete and private from mkstemp, is now renamed into
place under a lock on the instance folder, looking at the key file again
once the lock is held. No key file is opened for writing any more, and
none is ever visible unfinished.

The test that pinned the old create-then-lock order is replaced by two
that pin the new one.
The test that the 64-character token wraps at 320 and 390px looked for it in
the page's source. With #330 the page fetches the token when Show token is
pressed, so it was not there on the build of all PRs. The test presses the
button where the page has it and then measures the page with the token shown.
The API usage and graph buttons floated right, and the details table that
follows sits in a display: flow-root box, which keeps clear of a float by
going beside it when it fits. The table lost the buttons' width and sat level
with them, and in a phone the buttons were drawn over the header of the second
function. The buttons are now a right-aligned line of their own, above the
table, so nothing floats. A browser test pins their position and the table's
width at four window widths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant