Skip to content

fix(grouped): scope flex-wrap to narrow viewports (fixes #114) - #170

Merged
jenil merged 4 commits into
v1from
fix/grouped-controls-wrap
Jul 30, 2026
Merged

jenil merged 4 commits into
v1from
fix/grouped-controls-wrap

Conversation

@jenil

@jenil jenil commented Jul 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Scoped flex-wrap: wrap to narrow viewports via media query. On desktop, grouped controls stay horizontal (existing behavior). On narrow viewports (<480px), items wrap to vertical layout with proper spacing.

The Problem (original)

Grouped controls overflowed horizontally on narrow viewports instead of wrapping (issue #114).

The Problem (desktop regression)

Unscoped flex-wrap: wrap exposed that Chota inputs have width: 100%, causing inputs to fill the entire row on desktop and push buttons to a second row.

The Fix

/* Desktop: horizontal (existing behavior) */
.grouped {
  display: flex;
  gap: 0 16px;  /* horizontal 16px gap, no vertical gap */
}

/* Narrow viewports: wrap with row spacing */
@media (max-width: 480px) {
  .grouped {
    flex-wrap: wrap;
    gap: 16px;  /* 16px gap in both directions (horizontal + vertical) */
  }
  /* Gapless groups keep joined borders */
  .grouped.gapless {
    gap: 0;
  }
}

Size Impact

  • 3321 gzip bytes (baseline: 3326, ceiling: 4096) - under baseline
  • gap is supported by all target browsers

Test Results

15/15 tests pass (2 existing VRT + 13 new):

  • Desktop: horizontal, no wrapping, all items on same row (y positions match)
  • Mobile/Narrow: wraps with 16px gap between rows
  • Gapless + wrap: no regression, border-radius preserved, no extra gap
  • Disabled: opacity 0.4 preserved
  • Focus: box-shadow visible
  • Mixed controls: no overflow, existing heights preserved

Files Changed

  • src/_form.css - scoped media query + gap (7 lines)
  • test/vrt/grouped-controls.spec.js - 13 tests (new)
  • test/vrt/snapshots/ - 3 Chromium baselines (new)

Unresolved

  • Linux CI VRT baselines (requires CI platform)

Add flex-wrap: wrap to .grouped class to enable responsive wrapping
of grouped controls on narrow viewports instead of horizontal overflow.

Changes:
- src/_form.css: flex-wrap: wrap on .grouped (1 line, 2 gzip bytes)
- baselines: update size-baseline.json with 2-byte rationale
- test/grouped-controls.html: 9 validation fixtures
- test/vrt/grouped-controls.spec.js: 11 tests (3 VRT + 8 assertions)
- test/vrt/snapshots: 3 Chromium baselines (desktop/mobile/narrow)

Fixes issue #114: grouped controls now wrap vertically on narrow
viewports instead of overflowing horizontally.

Regression coverage:
- Gapless + wrap: no horizontal overflow, border-radius preserved
- Mixed controls: no overflow, existing heights preserved (select=36, input=36, button=38)
- Disabled controls: opacity 0.4 preserved
- Focus outlines: box-shadow visible
Problem: unscoped flex-wrap: wrap on .grouped exposed that Chota inputs
have width: 100%, causing inputs to fill the entire row on desktop and
push buttons to a second row. This broke existing desktop grouped-control
behavior.

Fix: scoped media query wrapping.
  @media (max-width: 480px) { .grouped { flex-wrap: wrap; } }

Behavior:
- Desktop (>480px): horizontal, no wrapping (existing behavior preserved)
- Mobile/Narrow (<480px): wraps to vertical layout (fixes #114)

Size impact: 14 gzip bytes (baseline: 3312 → 3326, ceiling: 4096)
Rationale: Scoped wrapping avoids the width:100% input issue while still
fixing the narrow-viewport overflow. All target browsers support @media.

Tests (15/15 pass):
- Desktop: horizontal, no wrapping (regression check)
- Desktop: all items on same row (y positions match)
- Mobile/Narrow: wraps without horizontal overflow
- Gapless + wrap: no regression, border-radius preserved
- Disabled: opacity 0.4 preserved
- Focus: box-shadow visible
- Mixed controls: no overflow, existing heights preserved
@jenil jenil changed the title fix(grouped): add flex-wrap: wrap to .grouped (fixes #114) fix(grouped): scope flex-wrap to narrow viewports (fixes #114) Jul 30, 2026
jenil added 2 commits July 30, 2026 00:31
When grouped controls wrap on narrow viewports, items on the second
(and subsequent) rows were touching the row above. Add 16px gap
between wrapped rows using flex gap, while keeping gapless groups
joined (gap: 0).

Changes:
- .grouped: gap: 0 16px (horizontal 16px, vertical 0 on desktop)
- @media (max-width: 480px): gap: 16px (both directions when wrapping)
- .grouped.gapless: gap: 0 (preserve joined borders when wrapping)

Size: 3321 bytes (baseline: 3326, ceiling: 4096) — under baseline.
- HTML: 9 fixtures -> 4 (desktop, narrow wrap, gapless wrap, mixed heights)
- Spec: 15 tests -> 4 (one per fixture, computed-style + overflow assertions)
- Screenshots: 3 full-page -> 4 targeted locator.screenshot() calls
- Removed: fullPage screenshots, disabled/focus tests, desktop full-width test
- Each test proves its fixture with computed-style and overflow assertions
@jenil
jenil merged commit e73c782 into v1 Jul 30, 2026
2 checks passed
@jenil
jenil deleted the fix/grouped-controls-wrap branch July 30, 2026 22:55
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