Finally with scrollbar-width there's also a way to hide the scrollbar in Firefox without breaking it's scrolling functionality.
Now all major browsers support a way of hiding the native scrollbar. As such, it's legitimate to offer an option to not wrap the element into an overflow: hidden; container.
Benefits:
- it does not mess with the elements
- no care needs to be taken when working with the target element in JS
- referencing elements inside it before using
scrollbarjs.add() no longer breaks the reference
- adding scrollbars to be body has no side effects (especially autohiding url bar on mobile)
- styling
- scrollbars can overflow the content, thus can be placed outside the viewport
- no need to handle
direction: rtl;
- no
::after workaround to add padding to the bottom needed
Finally with
scrollbar-widththere's also a way to hide the scrollbar in Firefox without breaking it's scrolling functionality.Now all major browsers support a way of hiding the native scrollbar. As such, it's legitimate to offer an option to not wrap the element into an
overflow: hidden;container.Benefits:
scrollbarjs.add()no longer breaks the referencedirection: rtl;::afterworkaround to add padding to the bottom needed