[feature] useDocumentOverflow - reactive and centralized document style overflow management
See original GitHub issueSometimes it’s useful to control document.documentElement.style.overflow
programmatically.
For example - when you open modal window and want to disable document scroll
Usage examples:
const { hideOverflow, restoreOverflow } = useDocumentOverflow();
// enable overflow: hidden
hideOverflow();
// remove overflow property
restoreOverflow();
// control X/Y and choose documentElement
const { overflowX, overflowY } = useDocumentOverflow({ documentElement: document.body });
overflowX.value = 'auto';
overflowY.value = 'hidden';
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
overflow - CSS: Cascading Style Sheets - MDN Web Docs
The overflow CSS shorthand property sets the desired behavior for an element's overflow — i.e. when an element's content is too big to...
Read more >How to remove jank from overflow:hidden?
This is done with two simple functions I set in my Javascript. function hidden() { document.querySelector("body").style ...
Read more >HTML DOM Style overflow Property - W3Schools
Tip: If you want to hide the scrollbars of the entire document, use the overflow property on the body or the html element....
Read more >vueuse - bytemeta
[feature]: createEventHook: new function. cawa-93 ... [feature] useDocumentOverflow - reactive and centralized document style overflow management.
Read more >CSS Overflow Module Level 3 - W3C
This module contains the features of CSS relating to scrollable ... to control the presence of scrollbars provided by the overflow property.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d like to add my 5 cents.
overflow: hidden
on adocument.body
is not enough for disabling document scroll. There are solutions, like https://github.com/willmcpo/body-scroll-lock that do it better. So in my opinion, it would be better to either integrate such solution to vueuse, or not make half-measures at allupd: sorry, looks like I’ve duplicated #534, should read that first
Going to close in favor of using a library like body-scroll-lock.