Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.0-beta.2 #24

Merged
merged 7 commits into from
Oct 25, 2023
Merged

1.0.0-beta.2 #24

merged 7 commits into from
Oct 25, 2023

Conversation

niklasramo
Copy link
Owner

@niklasramo niklasramo commented Oct 17, 2023

Bug fixes:

  • In the 1.0.0-beta.1 version we introduced a performance optimization to element width/height calculcation, but the optimization mistakenly included the scrollbar size for content and padding widths/heights. Additionally, the optimization produces a bit less accurate values than getBoundingClientRect(), which is otherwise okay, but it also causes the getRect() method to return data where the offsets are not fully in sync with the dimensions. And that is not okay. So I decided to drop it for now and think about it a bit more.
  • Fixed an issue with getHeight() method where it would not always subtract the scrollbar correctly.
  • You could consider this a feature instead of a bug fix, but let's call it what it really is. Previously, if the element had a scrollbar with a subpixel width/height (possible in Chromium-based browsers) the final width/height calculation for padding and content sizes would be incorrect. Now that's fixed. I think we got this done in nicely performant way without needing to resolve to adding test elements in the DOM (which would have sucked big time). It turns out that subpixel scrollbars vary in behaviour between devices/browsers, which means that we can't use the same assumption for all cases, which also means we have to test the behaviour in the DOM to get accurate results :( I built a cache system to store the corresponding real values for the values that window.getComputedStyle() reports. This way we can keep the DOM testing at minimum and only test when there actually is a custom subpixel scrollbar value defined. Closes More accurate scrollbar width/height. #22

@niklasramo niklasramo marked this pull request as ready for review October 25, 2023 20:17
@niklasramo niklasramo self-assigned this Oct 25, 2023
@niklasramo niklasramo merged commit 69dbdc8 into master Oct 25, 2023
1 check passed
@niklasramo niklasramo deleted the beta-2 branch October 25, 2023 21:31
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.

More accurate scrollbar width/height.
1 participant