Skip to content

fix(shared): report border-box dimensions from useResize#2432

Merged
joshuaellis merged 1 commit into
nextfrom
worktree-2288
May 21, 2026
Merged

fix(shared): report border-box dimensions from useResize#2432
joshuaellis merged 1 commit into
nextfrom
worktree-2288

Conversation

@joshuaellis
Copy link
Copy Markdown
Member

useResize reported contentRect, which excludes padding and border — so consumers measuring a padded element got back the inner content size instead of the rendered box. The fix observes elements with { box: 'border-box' } and reads borderBoxSize, with a contentRect fallback for entries that lack it. inlineSize/blockSize are flipped back to width/height for vertical and sideways writing modes so the public shape is unchanged.

Tests

New real-DOM test in resizeElement.test.ts exercises a padded + bordered element and a vertical writing-mode element against a real ResizeObserver.

Closes #2288
Closes #2419

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

🦋 Changeset detected

Latest commit: 94eba37

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@react-spring/shared Patch
@react-spring/animated Patch
@react-spring/core Patch
@react-spring/mock-raf Patch
@react-spring/parallax Patch
@react-spring/rafz Patch
@react-spring/types Patch
@react-spring/konva Patch
@react-spring/native Patch
@react-spring/three Patch
@react-spring/web Patch
@react-spring/zdog Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

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

Project Deployment Actions Updated (UTC)
react-spring Ready Ready Preview May 21, 2026 7:02pm

Request Review

@joshuaellis joshuaellis merged commit e5107dc into next May 21, 2026
15 checks passed
@joshuaellis joshuaellis deleted the worktree-2288 branch May 21, 2026 19:06
This was referenced May 21, 2026
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.

[bug]: useResize uses content box instead of border box

1 participant