-
Notifications
You must be signed in to change notification settings - Fork 30
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
Latest version applies scroll compensation twice #71
Closed
Comments
Tracked at theKashey/react-remove-scroll-bar#32 |
v2.5.4 has been released with the fix. |
https://react-ts-g2ondm.stackblitz.io/ seems to work fine when opened in a new tab. Inside stackblitz editor is does not work |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for the library!
Something broke for us while updating to the latest version, and now scroll compensation is applied twice.
Here's the playground link with a reproduction: https://stackblitz.com/edit/react-ts-ijvk6l?file=App.tsx
Here's the direct link to the demo: https://react-ts-ijvk6l.stackblitz.io
Expected behaviour is that green and blue areas would be the same size, but actual behaviour is that the blue area is smaller by the scrollbar width (well, the second compensation).
I dug around a bit, and noticed that the effect inside
styleHookSingleton
is actually called twice (the demo is not in StrictMode); once — with the correct styles (padding-right: 0;
), second time — withpadding-right: 15px;
, accounting for the compensation margin it just set).The issue is likely caused by this commit (theKashey/react-style-singleton@581f522), introducing
[styles]
dependency, which causes the double firing. I can confirm, that editing the file in the devtools and removing the dependency, fixes the behaviour. But I am not sure if that's actually the root cause of the issue and that it's not breaking something else.Workaround for the time being is just setting
padding: 0; !important
on the body, which overrides the double compensation.The text was updated successfully, but these errors were encountered: