Skip to content

docs(demos): let lane flow boxes wrap so demos fit phone screens - #164

Merged
lesnik512 merged 1 commit into
mainfrom
docs/demo-narrow-overflow
Oct 16, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
docs/demo-narrow-overflow

Conversation

@lesnik512

Copy link
Copy Markdown
Member

At phone width the circuit breaker and full stack demos made the page scroll sideways. The httpware lane's flow row (client, breaker, server) is a flex row whose .box items were white-space: nowrap, so they could not shrink below their one-line width. At 375px the row has about 303px, and client + "breaker CLOSED" + "server ✓" needed about 342px, more with labels like "server slow" or "breaker HALF_OPEN". The retry, bulkhead and timeout demos only have two boxes per row, so they fit.

This is a CSS-only change in docs/demos/demos.css. Dropping nowrap lets a box wrap its label at a space when the row runs out of room. Flex items still size to their one-line width while there is space, so nothing wraps at desktop width. A max-width: 480px media query also cuts the box font from .75rem to .7rem, the padding from 8px 10px to 7px 6px, and the row gap from 6px to 4px. That keeps the resting labels on one line on a phone (294px in the 303px row). Without it, the "✓" in "server ✓" dropped onto a line of its own. Only the longer transient labels ("breaker HALF_OPEN", "server slow") wrap to two lines now. engine.js is unchanged.

Testing

A throwaway headless Playwright script against mkdocs serve loads each demo page at 375x740 and 1280x800. It checks document.documentElement.scrollWidth <= clientWidth before playing, then plays every scenario (and the retry herd demo), checks again at every tour stop, and once more at the end of the run. That is 82 checks in all.

On main, 13 of the 82 fail, all at 375px on the circuit breaker and full stack pages:

page, 375px main scrollWidth branch scrollWidth
circuit breaker, before play 379 375
circuit breaker, stops 1, 2, 5 and end (both scenarios) 379 375
full stack, before play 379 375
full stack, stop 1 ("server slow") 406 375
full stack, stop 2 and end 379 375

On this branch all 82 pass. The circuit breaker stops 3 and 4 and full stack stops 3 and 4 already passed on main, because the server box there reads "server ✗" and is shorter. Retry, bulkhead and timeout stay at scrollWidth equal to clientWidth at both sizes.

To check that desktop is unchanged, a second script records the bounding box of every element inside each .hw-demo at 1280x800, on main and on the branch. The two dumps are byte-identical for all five pages.

mkdocs build --strict passes.

Screenshots

Circuit breaker at 375px, main then branch:

Full stack at 375px, main then branch:

Full stack at 375px, paused at the first tour stop, main then branch:

Circuit breaker and full stack at 1280px on the branch:

The screenshots live on the pr-assets/demo-narrow-overflow branch, which can be deleted once this is merged.

@lesnik512
lesnik512 merged commit 3d77468 into main Oct 16, 2026
13 checks passed
@lesnik512
lesnik512 deleted the docs/demo-narrow-overflow branch October 16, 2026 18:13
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