Skip to content

Horizontal Scroll even after Disable X-Axis Scrolling #480

Answered by idiotWu
blitzve0 asked this question in Q&A
Discussion options

You must be logged in to vote

Oh, that's because we forget to make the scrolling delta from select events transformable 🤦‍♂️. That's surely a bug, but I think we can get rid of the horizontal scrollbars with several lines of CSS, and you won't need a plugin anymore:

.layout {
    /* height: 100vh; <- not sure why you wrote this but it seems safe to delete it */
    background: #fff;
    overflow: hidden; /* add this */
}

Edit: you also need to recalculate the floating contact button's position to avoid overflow: bottom = scrollbar.limit.y - scrollbar.offset.y. Here is a helper function for fixed elements: https://codesandbox.io/s/smooth-scrollbar-fixed-element-ki0syo?file=/src/fixed-element.ts

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@blitzve0
Comment options

@idiotWu
Comment options

Answer selected by blitzve0
Comment options

You must be logged in to vote
5 replies
@blitzve0
Comment options

@sadeghbarati
Comment options

@blitzve0
Comment options

@Robmel12
Comment options

@LiuN1an
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants