Skip to content

feat(AutoSizer): measure via getBoundingClientRect + add roundingMode prop for sub-pixel rounding control#1898

Open
jonw09 wants to merge 1 commit into
bvaughn:masterfrom
jonw09:feature/autosizer-rounding
Open

feat(AutoSizer): measure via getBoundingClientRect + add roundingMode prop for sub-pixel rounding control#1898
jonw09 wants to merge 1 commit into
bvaughn:masterfrom
jonw09:feature/autosizer-rounding

Conversation

@jonw09

@jonw09 jonw09 commented Jul 2, 2026

Copy link
Copy Markdown
  • The existing test suites (npm test) all pass
  • For any new features or bug fixes, both positive and negative test cases have been added
  • For any new features, documentation has been added
  • For any documentation changes, the text has been proofread and is clear to both experienced users and beginners.
  • Format your code with prettier (yarn run prettier).
  • Run the Flow typechecks (yarn run typecheck).

--

As it stands right now the AutoSizer has an issue; any fractional heights/widths are rounded up. This means the child content is told it has more space to play with than the reality which can lead to overflow issues and the likes.

This change proposes a shift to using getBoundingClientRect which consumes the fractional height/width correctly and then rounds it according to the newly exposed roundingMode prop. By default, for backwards compatibility it will use ceil which rounds upwards.

@jonw09 jonw09 changed the title feat(AutoSizer): measure via getBoundingClientRect + add `roundingM… measure via getBoundingClientRect + add roundingMode prop for sub-pixel rounding control Jul 2, 2026
@jonw09 jonw09 changed the title measure via getBoundingClientRect + add roundingMode prop for sub-pixel rounding control feat(AutoSizer): measure via getBoundingClientRect + add roundingMode prop for sub-pixel rounding control Jul 2, 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.

1 participant