Skip to content

Embed: two-row toolbar in narrow frames - #420

Merged
neuromechanist merged 2 commits into
stagingfrom
feature/embed-compact-toolbar
Oct 5, 2026
Merged

neuromechanist merged 2 commits into
stagingfrom
feature/embed-compact-toolbar

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Part of #410 (feedback on the 360 x 480 preview: the toolbar took three rows and squeezed the plot).

Change

In the embed's existing @media (max-width: 560px) block, which already hides the group captions:

  • The time readout ("0.0–10.0 s") is visually hidden. The time axis under the plot labels the window already. The text stays in the accessibility tree, since screen readers cannot read the canvas axis.
  • The gap between toolbar groups, and the padding before each group's divider, go from --space-3 to --space-2. Without this the second row is a few pixels too wide for the gear.
  • viewer.ts gives the time readout a modifier class (eegv__readout--time), so the rule can target it and not the channel readout. Nothing else in the shared viewer changes, and the dataset page is untouched (every rule is under .embed__viewer).

Measurements

on007753, ?view=sub-05_task-BCCWJreading, against bun run dev, the same build with and without the CSS:

Frame Engine Toolbar before Toolbar after Plot before Plot after
360 x 480 Chromium 3 rows, 108 px 2 rows, 67 px 182 px 223 px
360 x 480 WebKit 3 rows, 106 px 2 rows, 65 px 189 px 230 px
320 x 480 Chromium 3 rows, 108 px 2 rows, 67 px 156 px 197 px
400 to 560 x 480 Chromium 2 rows, 71 px 2 rows, 67 px 219 to 245 px 223 to 249 px

From 320 to 800 px wide the toolbar takes two rows or fewer in both engines, and the document never scrolls. From 400 to 560 px the readout used to fit in two rows. It is hidden there too: one breakpoint, and a longer readout late in a long recording ("2330.0–2338.0 s"), or in clock mode, would wrap it to three rows at those widths.

Tests

  • bun run lint, bun run typecheck (0 errors), bun run test (2989 passed)
  • Width sweep (320, 360, 400, 480, 560, 561, 640, 800) in Chromium and WebKit: toolbar rows, plot height, document scroll, readout hidden only at 560 px or less

Review (1 reviewer, small CSS change) and fixes, db427be

  • Important: the group-spacing rule leaked into the gear popover, indenting three of its four groups by 8 px. It now selects .eegv__toolbar > .eegv__group + .eegv__group only. Popover group padding measured 0 at 320, 360, 560 and 800 px in Chromium and WebKit.
  • Comment and CHANGELOG overstated what the spacing buys. Hiding the readout alone gets 360 px to two rows. The tighter spacing takes 4 px off the row gap and keeps 320 to 330 px frames at two rows. The wording now says that.
  • The two-row claim holds for a recording with one channel group. A Group select (more than one group) adds width, and 360 px is then three rows. The comment and CHANGELOG now qualify the claim.
  • The modifier class's only consumer was invisible from viewer.ts. There is now a comment at its definition pointing to embed.astro, and the hide block names .visually-hidden as its model.
  • Pre-existing, filed as Embed: plot height jumps when the time readout grows (frames wider than 560 px) #421: above 560 px, the readout's growing text can add a toolbar row while paging, so the plot jumps about 44 px.

Found while checking the fix: phase 1's caption rule hid the popover's captions in narrow frames as well ("Filter (Hz)", "Display", "Next moves through", "Preload"). The popover floats over the plot, so those captions cost no plot height. They are back, and the popover's spacing tightens at 560 px or less so it still fits: at 360 x 480 with the popover open the document does not scroll (menu bottom at 456 px in Chromium, 437 px in WebKit). At 320 x 480 in Chromium it overflows by 2 px while open; that is below the smallest supported frame.

At 560 px wide or less, the embed hides the time readout (the plot's time
axis already shows the window; screen readers still get the text) and
tightens the spacing between toolbar groups. A 360 x 480 frame's toolbar
goes from three rows (108 px) to two (67 px), and the plot grows from
182 to 223 px in Chromium and from 189 to 230 px in WebKit. Measured
from 320 to 800 px wide: two rows or fewer at every width, and the
document never scrolls. The dataset page is unchanged.

Tested: lint, typecheck, 2989 unit tests; width sweep in Chromium and
WebKit against bun run dev.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review of #420: the group-spacing rule also matched the gear popover's
groups and indented three of them by 8 px; it now selects only the
toolbar's direct groups. The same leak, from phase 1, hid the popover's
captions ("Filter (Hz)", "Next moves through", ...) in narrow frames;
those are back, paid for with tighter popover spacing so the open
popover still fits a 360 x 480 frame. Comments and the CHANGELOG line
now say what each rule buys, and that the two-row claim is for a
recording with one channel group.

Tested: lint, typecheck, unit tests; popover group padding 0 at 320 to
800 px, toolbar unchanged (67 px at 360), no document scroll at 360 x 480
with the popover open, Chromium and WebKit.
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