Skip to content

fix: center non-overflowing rails - #1

Merged
saeedet merged 2 commits into
mainfrom
fix/center-non-overflowing-rail
Oct 11, 2026
Merged

saeedet merged 2 commits into
mainfrom
fix/center-non-overflowing-rail

Conversation

@saeedet

@saeedet saeedet commented Oct 11, 2026

Copy link
Copy Markdown
Owner

initialPosition="center" only set a scroll offset. When all items fit, the scroll range was zero and the group stayed start-aligned. This patch centers fitting groups with safe flex alignment while retaining midpoint scrolling for overflowing content. It uses the captured initial value, preserves consumer style precedence and direct children, and adds no runtime dependencies.

Resize regression coverage also exposed browser-driven offset clamping being mistaken for user movement before ResizeObserver delivery. The initial-position controller now recognizes that clamp; pointer/wheel/keyboard intent and imperative scrolling still end automatic positioning.

The existing playground gains a Photos selector (1–6). Choose 2 with Start at: Middle, then resize to compare fitting and overflowing content. README, architecture/validation notes, changelog, and package/lock versions are updated for 0.1.1.

Validation:

  • Reproduced the original missing alignment in unit tests and Chromium before the fix.
  • npm ci, npm run check: passed; 51 unit/SSR tests, strict TypeScript, lint, formatting, package budgets and export checks.
  • npm run test:e2e: 96 passed, 4 intentional CDP-only skips across all five browser profiles, including current WebKit 26.6.
  • Added physical-layout, mixed-width/gap, style-override, start/end, LTR/RTL, responsive, user-ownership, SSR, and photo-count coverage. Repeated Chromium resize checks passed.
  • npm run build:demo (root and Pages base), npm run build:next, npm run test:next, npm run test:package: passed. React 18/19 tarball imports, CSS, and SSR passed.
  • npm pack --dry-run and actual pack inspected: 12 intended files, about 21.8 KB compressed; no examples/tests/reference assets. JS grows by 41 gzip bytes; CSS unchanged.
  • Desktop two-photo layout: 404px free space on both sides; mobile: no document-wide horizontal overflow.

Release through the existing manually triggered publish.yml against v0.1.1 after CI and merge. If npm trusted publishing is unavailable, keep the tag prepared and report the authentication blocker; do not add repository credentials.

@saeedet
saeedet merged commit 0bc7234 into main Oct 11, 2026
2 checks passed
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