Skip to content

fix(viewer): chart title-row + spectrum controls survive narrow screens#925

Merged
thinkingfish merged 3 commits into
iopsystems:mainfrom
thinkingfish:fix/narrow-chart-title-wrap
May 13, 2026
Merged

fix(viewer): chart title-row + spectrum controls survive narrow screens#925
thinkingfish merged 3 commits into
iopsystems:mainfrom
thinkingfish:fix/narrow-chart-title-wrap

Conversation

@thinkingfish
Copy link
Copy Markdown
Member

@thinkingfish thinkingfish commented May 13, 2026

Summary

Layout fixes for narrow viewports (iPhone-class, tablet portrait, narrow desktop windows) on histogram-quantile charts.

  • .chart-title-row got flex-wrap: wrap and a 4px 12px gap. Long titles + the right-side per-card controls (compare toggle, etc.) no longer collide — the right side drops to a second line when the title fills the available width.
  • SPECTRUM_CONTROLS_NARROW_WIDTH bumped 500 → 700px, catching the in-between widths where the narrow code path was needed but didn't fire. Narrow top tightened 28 → 24, narrow right bumped 12 → 28 so the Full / Tail checkboxes sit ~1em inside the legend's right edge instead of crowding it.
  • Checkbox glyph centered against its label via inline-flex; align-items: center plus a 2px upward translateY to compensate for the ☐/☑ characters' built-in bottom whitespace.

Test plan

  • node --check on the touched JS files clean
  • node --test tests/*.mjs — 82/82
  • bash tests/viewer_smoke.sh — full pass
  • Manual: confirmed Full / Tail no longer crowds the percentile legend on narrow charts and that the checkbox glyphs read as centered against the labels

🤖 Generated with Claude Code

thinkingfish and others added 3 commits May 13, 2026 15:40
iPhone (and other narrow viewports) had two layout issues:
- The chart's title row (title + per-card controls) sat on one flex
  row with no wrap — long titles collided with the right-side controls
  on screens under ~400px.
- The Full / Tail spectrum checkboxes only relocated to a separate
  line below 500px chart width. iPhone in landscape, tablet portrait,
  and narrow desktop windows all stayed above that threshold and
  rendered the checkboxes on top of the percentile legend.

Two minimal fixes:
- `.chart-title-row`: add `flex-wrap: wrap` so the right-side controls
  drop to a second line gracefully when the title gets long. Switches
  the row gap from `12px` to `4px 12px` so the wrapped row sits 4px
  below the title instead of 12.
- `SPECTRUM_CONTROLS_NARROW_WIDTH` 500 → 700: catches the in-between
  widths where the narrow code path was needed but didn't fire. Also
  tightens `top` from 28 → 24 to give the legend (at top:42) a real
  6px gap from the spectrum's 13px control baseline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Narrow-mode `right` 12 → 28 so the Full/Tail checkboxes sit ~1em
  inside the legend's rightmost chip instead of crowding it.
- `renderSpectrumCheckbox`: switch the toggle span to inline-flex with
  align-items:center, dropping the manual `vertical-align:bottom +
  position:relative; top:2px` nudge that left the 16px glyph slightly
  below the 13px label baseline. The flex midline keeps glyph and
  label visually centered across browsers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The ☐/☑ characters carry extra inner whitespace at the bottom of
their glyph box, so flex `align-items: center` still leaves them
sitting low next to the label baseline. A 2px upward translate on
the glyph span compensates and reads as true center alignment.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thinkingfish thinkingfish force-pushed the fix/narrow-chart-title-wrap branch from d49a674 to 08be3bb Compare May 13, 2026 23:07
@thinkingfish thinkingfish marked this pull request as ready for review May 13, 2026 23:07
@thinkingfish thinkingfish merged commit be5e8c0 into iopsystems:main May 13, 2026
12 checks passed
@thinkingfish thinkingfish deleted the fix/narrow-chart-title-wrap branch May 13, 2026 23:12
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