Design Systems and Worst-Case UI Stress Testing
You can size the Tuesday desk shell from CSS custom properties, wrap a 180-character URL inside a 592px name column, and load fixtures 01 through 15 with 0 collisions, 0 clipped blocks, and 0 uncaught errors.
- Level
- Navigator
- Time
- 26 h
- Prerequisites
- R05-301

Jump to
After this course you can
The student can build a token-driven component library and application shell that renders all 15 worst-case edge-case datasets without text clipping, overlapping controls, or unhandled runtime exceptions.
Tokens on the desk shell
A token in this shell is a CSS custom property set on the element desk-shell. A descendant reads it with var(), and a value written on the shell reaches the button inside a row. The sheet for this lesson is fixed: --space-1 is 4px, --space-2 is 8px, --space-3 is 12px, --space-4 is 16px, --font is 16px, --leading is 1.25, --stroke is 1px, --ring is 2px, --panel is 736px, --action is 96px, --pad-x is 16px, --gap is 16px, and --window is 480px. The line box is 16 × 1.25 = 20px. The Open button uses font-size var(--font), line-height var(--leading), padding-block var(--space-2), padding-inline var(--space-3), a solid border of var(--stroke), width var(--action), and box-sizing border-box. Its border-box height is the 20px line, plus 8px and 8px of block padding, plus 1px and 1px of border, which is 38px. Its content width is 96 − 12 − 12 − 1 − 1 = 70px.
Change only --space-2 from 8px to 12px. The token button's block padding becomes 12px plus 12px, so the height becomes 20 + 12 + 12 + 2 = 46px. A button that hard-coded padding-block 8px stays at 38px. The two heights differ by 46 − 38 = 8px. The focus ring is an outline of --ring, 2px, with an offset of 2px, so the ring paints 2 + 2 = 4px outside the border box. The column gap is 16px, and 16 − 4 = 12px of paper remains between the ring and the name. The collision test reads getBoundingClientRect, which reports the border box and leaves the outline outside those numbers. Change only --gap from 16px to 24px and leave --pad-x at 16px. The inner grid stays 736 − 16 − 16 = 704px. The name column becomes 704 − 24 − 96 = 584px, 8px narrower than 592px. The button's left edge stays at 16 + 584 + 24 = 624px.
A name column that can shrink
The row is a two-column grid inside the 736px panel. Padding uses --pad-x on the left and on the right, so the grid is 704px wide. Column two is --action, 96px. The gap is --gap, 16px. Column one is 704 − 16 − 96 = 592px, and that cell sets min-width to 0. The name's border box starts at x 16 and ends at 16 + 592 = 608. The button's border box starts at 608 + 16 = 624 and ends at 624 + 96 = 720. The right padding then runs from 720 to 736. This lesson's measuring rule makes a hand count exact. A Latin letter, a digit, a space, and a URL character each count as 8px. An Arabic letter counts as 8px. A CJK ideograph counts as 16px. The one emoji grapheme in fixture 08 counts as 24px. overflow-wrap is anywhere. A line holds as many whole characters as fit in the content width. 592 / 8 = 74, so a Latin name holds 74 characters on a line. The button content box is 70px. 8 × 8 = 64, and 70 − 64 = 6, so 6px remain and the button holds 8 Latin characters on a line. Text height is the line count times 20px. The row's border-box height is 8px, plus the taller of the name's text height and the button's border-box height, plus 8px, plus the 1px border-bottom.
Two boxes collide only when each one crosses the other on both axes: the left of A is less than the right of B, the right of A is greater than the left of B, the top of A is less than the bottom of B, and the bottom of A is greater than the top of B. On the ordinary row the name runs from x 16 to 608 and the button runs from x 624 to 720. The comparison 608 > 624 fails, so the collision count is 0 even where the boxes share vertical space. A long URL with min-width left at auto refuses to shrink. Fixture 05's URL is 180 characters, and 180 × 8 = 1440px. The grid's minimum becomes 1440 + 16 + 96 = 1552px, and the padded panel becomes 1552 + 32 = 1584px. The overflow past the 736px panel is 1584 − 736 = 848px. With min-width 0 the same URL wraps. 74 × 2 = 148, and 180 − 148 = 32, so the leftover 32 characters occupy a third line. Text height is 3 × 20 = 60px. The Open button is 38px tall, the name is the taller cell, and the row is 8 + 60 + 8 + 1 = 77px. The clip gate subtracts clientHeight from scrollHeight. The shell sets no max-height and no line clamp, so that difference is 0 and the whole string stays visible.
Fifteen fixtures, one id at a time
The loader keeps the ids 01 through 15 in that written order and mounts one id at a time. The array length is 15, the first id is 01, and the last id is 15. Fetch runs only when net is slow. Net off paints the saved desks and calls fetch 0 times. Net slow calls fetch once, at 0 ms, and that call settles at 3000 ms. Every other fixture has net on and already holds its desks, so its fetch count is 0. Fixture 01 has 0 desks. The list renders 0 rows and one empty state. That empty state is 16px of padding, a 20px sentence, an 8px gap, the 38px Add desk button, and 16px of padding, which sums to 98px. Add desk is 8 characters and 64px wide, so it fits on one button line. Enabled buttons: 1. Fixture 02 is the name Desk 14, 7 characters, one line, a 55px row, and 1 button. Fixture 03 holds 10000 desks. The window is 480px and the one-line stride is 55px. 55 × 8 = 440, and 480 − 440 = 40, which is under 55, so the shell mounts 8 rows and leaves 10000 − 8 = 9992 desks uncreated. Enabled buttons: 8. Fixture 04 is 280 copies of the letter A. 74 × 3 = 222, and 280 − 222 = 58, so the name uses 4 lines. Text height is 80px, and the row is 8 + 80 + 8 + 1 = 97px. Fixture 05 is the 180-character URL, 3 lines, row 77px. Fixture 06 sets dir to rtl and repeats the Arabic letter ب twelve times. 12 × 8 = 96px, so the name is one line and the row keeps one button. The stylesheet leaves the order property unset. The visual flip comes from dir, and the tab-stop count stays 1. In that mirrored row the name's right edge is 736 − 16 = 720, so its left edge is 720 − 592 = 128. The button's right edge is 128 − 16 = 112, and its left edge is 112 − 96 = 16. The comparison 128 < 112 fails, so the collision count stays 0. Fixture 07 is eight copies of the ideograph 机. Each counts as 16px, the width is 8 × 16 = 128px, and 128 is under 592, so the name is one line. Fixture 08 is one grapheme of 24px, built from the five code points U+1F468, U+200D, U+1F469, U+200D, and U+1F467. A pass keeps one text node, a code-point length of 5, and a grapheme count of 1. Removing both U+200D points would leave a length of 3.
Fixture 09 omits the name field. The visible label is the seven-character string (empty), and the error count is 0. Reading length on a missing name throws a TypeError, and that throw counts as one uncaught error. Trimming before the fallback throws as well, because the missing value has nothing to trim. The shell checks for an absent name first and for a trimmed length of 0 second. Fixture 13 sets the name to three spaces. The trimmed length is 0, so the label is (empty) and the error count is 0. Fixture 14 sets the name to Desk, then a newline, then 14. The shell replaces that newline with one space, producing Desk 14, 7 characters on one line, and the row count stays 1. Fixture 12 sends the ids d1 and d1. The first copy keeps d1. A later copy of the same id receives a hyphen and its occurrence number, counting from 1, so the second row is d1-2. getElementById of d1 returns one element. The data-row count is 2, and the error count is 0. Fixture 10 sets net to off and saves 4 desks. The fetch count is 0, the row count is 4, and the banner reads Offline. Saved desks: 4. Fixture 11 sets net to slow with those same 4 desks. At 0 ms the status reads Loading, the row count is 0, and the fetch count is 1. At 3000 ms the status reads 4 desks, the row count is 4, and the fetch count is still 1. Fixture 15 replaces the Open label with Open the Tuesday desk record now please, 39 characters. The button holds 8 characters a line. 8 × 4 = 32, and 39 − 32 = 7, so the label uses 5 lines. Text height is 100px. The button's border-box height is 8 + 100 + 8 + 2 = 118px, and its width stays 96px. The short name beside it is one line, so the row becomes 8 + 118 + 8 + 1 = 135px. The name still ends at x 608 and the button still starts at x 624, so the collision count is 0.
Three gates and the button count
The list region has the accessible name Desks. Each mounted row is one list item with one button of type button. That control activates on a click and on Enter, and a click on it submits no form. The accessible name of each button is the visible label. Open is that label on fixtures 02 through 14. Fixture 15 uses the 39-character label. Fixture 01's only button is Add desk. Tab order follows the DOM. The shell adds no tabindex and sets no CSS order. The keyboard count for a fixture is the number of enabled buttons in that mounted tree. Counted after fixture 11 has settled, the fifteen counts are 1, 1, 8, 1, 1, 1, 1, 1, 1, 4, 4, 2, 1, 1, and 1. At 0 ms fixture 11 contributes 0 buttons, because those four rows are still waiting on the fetch. At 3000 ms it contributes 4.
A passing run visits the ids in order, one at a time, and writes three zeros for each id: collisions, clipped blocks, and uncaught errors. A clipped block is one element whose scrollHeight exceeds its clientHeight. It also writes the button count above. Fixture 03's 8 buttons are the whole keyboard for that id. The 9992 unmounted desks add no stops and no nodes. A shell that mounts all 10000 rows fails that fixture, because the expected data-row count is 8. Across all 15 fixtures the passing shell records 0 collisions, 0 clipped blocks, and 0 uncaught errors.
Fixtures 05 and 03 on one shell
The panel is 736px. The grid is 704px. The name column is 592px and the button column is 96px, with 16px between them. The name border box ends at 608. The button border box starts at 624. The comparison 608 > 624 fails, so these two boxes contribute 0 to the collision count. The ring occupies 4px of the gap and leaves 12px of paper.
Fixture 05's URL is 180 characters. At 8px each it would be 1440px on one line. With min-width left at auto the padded panel becomes 1584px and overflows the shell by 848px. With min-width 0 the line holds 74 characters. Two lines hold 148, the remaining 32 characters fill line 3, the text is 60px, and the row is 77px. scrollHeight minus clientHeight is 0.
Fixture 03 has 10000 desks and a 480px window. The one-line stride is 55px. Eight strides are 440px, and the leftover 40px is short of another row, so the DOM holds 8 data-row elements and 8 Open buttons. The other 9992 desks stay uncreated. The three gates for this id are 0, 0, and 0.
Fixture 15's label is 39 characters, wrapped at 8 per line to 5 lines, and the button border box is 118px tall inside a 135px row. Fixture 09 prints (empty) and records 0 errors. Fixture 10 calls fetch 0 times and shows the banner Offline. Saved desks: 4. Fixture 12 emits d1 and d1-2.
Check it on paper
Use the same shell. For fixture 04, a name of 280 A's, write the line count, the text height, the row height, and the overflow in px if min-width stays auto. Then set --gap to 24px, leave --pad-x at 16px, and write the new name width and the button's left edge. For fixture 06, write the name's left edge, the button's left edge, and the comparison that keeps the collision count at 0. For fixture 11, write the status, the row count, and the fetch count at 0 ms and at 3000 ms. For fixture 08, write the code-point length and the grapheme count on a pass. For fixture 14, write the measured string and the row count.
Fixture 04 uses 4 lines, a text height of 80px, and a row height of 97px. The unwrapped name is 2240px, the padded panel is 2384px, and the overflow is 1648px. With --gap at 24px the name column is 584px and the button's left edge stays at 624px. Fixture 06 places the name's left edge at 128 and the button's left edge at 16. The comparison 128 < 112 fails, so the collision count is 0. Fixture 11 at 0 ms reads Loading, with 0 rows and a fetch count of 1. At 3000 ms it reads 4 desks, with 4 rows and a fetch count of 1. Fixture 08 passes with code-point length 5 and grapheme count 1. Fixture 14 measures Desk 14 and keeps 1 row.
Check questions
If --space-2 changes from 8px to 12px, what is the token button's height, what is the hard-coded button's height, and by how many px do they differ?
46px for the token button, 38px for the hard-coded button, and the difference is 8px.
Fixture 05 wraps a 180-character URL. How many lines does the name use, what is the row height, and how many px does the panel overflow if min-width stays auto?
3 lines, a row of 77px, and an overflow of 848px.
How many data-row elements does fixture 03 mount, how many desks stay uncreated, and why is the collision count 0 when the name ends at x 608 and the button starts at x 624?
It mounts 8 rows and leaves 9992 desks uncreated. The collision count is 0, because the comparison 608 > 624 fails.
What label does fixture 09 show, how many times does fixture 10 call fetch, and which two ids does fixture 12 emit?
The label is (empty), fixture 10 calls fetch 0 times, and the ids are d1 and d1-2.
The token shell keeps a 592px name column beside a 96px button at x 624, fixture 05 wraps the URL onto 3 lines in a 77px row, fixture 03 mounts 8 of 10000 desks, and each of the 15 fixtures ends at 0 collisions, 0 clipped blocks, and 0 uncaught errors.
Final task
Submit a component system with a deterministic fixture loader; automated Playwright visual-box and DOM tests load 15 extreme edge-case datasets and verify zero bounding-box collisions, zero uncaught errors, and intact keyboard accessibility.
Terms in this course
This course has no terms of its own in the glossary yet. Terms from earlier courses are used here too.
The first lesson is open to read. The rest of the course is being written, and tests and diplomas come later. Join the waitlist