Skip to content

feat: align with scrollIntoView, and modernize the toolchain - #1

Merged
faustienf merged 2 commits into
mainfrom
feat/scroll-into-view-parity
Aug 16, 2026
Merged

faustienf merged 2 commits into
mainfrom
feat/scroll-into-view-parity

Conversation

@faustienf

Copy link
Copy Markdown
Owner

Alignment now follows Element.scrollIntoView instead of approximating it. "start" and "end" are logical, so on the x axis they resolve against the container's direction and swap sides in an RTL container. The container's scroll-padding and the target's scroll-margin are both honoured, and alignment is measured against the scrollport rather than the border box.

Two changes need attention when upgrading:

  • The offset option is gone, replaced by the container's scroll-padding. One number could not describe two axes — aligning both at once applied the same inset horizontally and vertically — nor a header and a footer of different heights. offset: 80 becomes scroll-padding-top: 80px on the container.
  • "start" and "end" swap sides in RTL containers, where they now mean what the platform means by them. Left-to-right containers are unaffected.

Found while reviewing, and fixed here:

  • Alignment measured the border box rather than the scrollport, so a border pushed the target underneath itself, "nearest" judged a target hidden by the border to be visible and refused to scroll, and a vertical scrollbar shifted every horizontal alignment by its own width. The last of those affects most scrollable containers. The scrollport is now read from clientTop/clientLeft and clientHeight/clientWidth.
  • scroll-padding values that together exceed the scrollport left an inverted region, in which every target counted as too large to fit and "nearest" moved even a plainly visible one. They are reduced proportionally now.
  • The exports map resolved ESM type declarations for CJS consumers: the types condition sat above require, so the nested require.types was never reached and require() got .d.ts types for a .cjs implementation.
  • The Quick Start example in the README did not type-check.

The toolchain moves to match easing-scroll: tsdown in place of tsup, publint and are-the-types-wrong on every build, vitest coverage held at a 100% threshold, Prettier, CI on every pull request across Node 22 and 24, and publishing from GitHub Actions over OIDC instead of from a developer machine. The example is a workspace member that depends on the package via workspace:*, so its type check exercises the exports map the way a published consumer would.

Alignment now follows Element.scrollIntoView instead of approximating it.
"start" and "end" are logical, so on the x axis they resolve against the
container's direction and swap sides in an RTL container. The container's
scroll-padding and the target's scroll-margin are both honoured, and alignment
is measured against the scrollport rather than the border box.

Two changes need attention when upgrading:

- The `offset` option is gone, replaced by the container's scroll-padding. One
  number could not describe two axes — aligning both at once applied the same
  inset horizontally and vertically — nor a header and a footer of different
  heights. `offset: 80` becomes `scroll-padding-top: 80px` on the container.
- "start" and "end" swap sides in RTL containers, where they now mean what the
  platform means by them. Left-to-right containers are unaffected.

Found while reviewing, and fixed here:

- Alignment measured the border box rather than the scrollport, so a border
  pushed the target underneath itself, "nearest" judged a target hidden by the
  border to be visible and refused to scroll, and a vertical scrollbar shifted
  every horizontal alignment by its own width. The last of those affects most
  scrollable containers. The scrollport is now read from clientTop/clientLeft
  and clientHeight/clientWidth.
- scroll-padding values that together exceed the scrollport left an inverted
  region, in which every target counted as too large to fit and "nearest" moved
  even a plainly visible one. They are reduced proportionally now.
- The exports map resolved ESM type declarations for CJS consumers: the `types`
  condition sat above `require`, so the nested `require.types` was never
  reached and require() got .d.ts types for a .cjs implementation.
- The Quick Start example in the README did not type-check.

The toolchain moves to match easing-scroll: tsdown in place of tsup, publint and
are-the-types-wrong on every build, vitest coverage held at a 100% threshold,
Prettier, CI on every pull request across Node 22 and 24, and publishing from
GitHub Actions over OIDC instead of from a developer machine. The example is a
workspace member that depends on the package via workspace:*, so its type check
exercises the exports map the way a published consumer would.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
scroll-into-area Ready Ready Preview Aug 16, 2026 8:17pm

The matrix exercised the toolchain twice over, not the library: the published
bundle is browser code with no Node API in it, and the suite runs in jsdom, so
neither varies by Node version. What is left is picking the one version worth
running, and 22 is both the floor the toolchain leaves — tsdown wants
^22.18.0 || >=24.11.0, jsdom ^22.22.2 || ^24.15.0 || >=26.0.0 — and the version
release.yml publishes from, so CI now matches what actually ships.

With the matrix gone the job needs no explicit name; it reports as `check`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@faustienf
faustienf merged commit a8a1c15 into main Aug 16, 2026
3 checks passed
@faustienf
faustienf deleted the feat/scroll-into-view-parity branch August 16, 2026 20:19

This branch was successfully deployed

1 active deployment
Preview — 241a5f07 Deployed Aug 16, 2026 by vercel[bot]
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