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

Remove overflow-y from html element #1197

Open
DedDorito opened this issue Jul 31, 2017 · 14 comments
Open

Remove overflow-y from html element #1197

DedDorito opened this issue Jul 31, 2017 · 14 comments
Assignees
Labels
framework Issues and Feature Requests that have needs framework-wide. T: enhancement Functionality that enhances existing features

Comments

@DedDorito
Copy link

Steps to reproduce

Use Vuetify.

Versions

Latest of everything.

What is expected ?

html element to have no overflow-y set or overflow-y: auto

What is actually happening ?

html element has overflow-y: scroll, which forces a scrollbar to always be present.

Reproduction Link

https://codepen.io/anon/pen/JyXrNz

@Ragura
Copy link

Ragura commented Jul 31, 2017

For me the biggest problem with this is the shifting of the page content that occurs when opening a dialog, because the dialog removes the scrollbar entirely (or pushes it aside?).
I worked around it by manually setting the overflow-y to auto, but I've read in previous issue reports on this matter that it messes up the menus (don't have any in my app atm).

@DedDorito
Copy link
Author

Yeah, I experienced the same thing with dialogs as well (navigation drawer too, etc.). I was assuming there is a reason for this, but perhaps there's a better way to achieve the same outcome than always persisting a scrollbar (main reason why I created this).

@johnleider johnleider added the pending review The issue is still pending disposition label Aug 2, 2017
@johnleider
Copy link
Member

The problem with this is there are just as many people who are already used to this. On top of that, a few points:

  • The scroll-bar appearing and disappearing can be jarring when you have an SPA that switches between pages
  • It's part of the reset we use and I specifically wanted

This has been brought up in the past, I just don't think it's difficult for a developer to just turn it off if they don't want it.

@johnleider johnleider added T: feature A new feature and removed pending review The issue is still pending disposition labels Aug 2, 2017
@Ragura
Copy link

Ragura commented Aug 2, 2017

The scroll-bar appearing and disappearing can be jarring when you have an SPA that switches between pages
I agree, but this is exactly what's happening with the current behaviour for components that do disable the scrollbar, like the dialog components. Content on the page jumps around because of the extra width. Unless there is an easy way to disable this as well?

@johnleider
Copy link
Member

I don't understand that last part.

@DedDorito
Copy link
Author

The scroll-bar appearing and disappearing can be jarring when you have an SPA that switches between pages

Isn't this the default behavior of nearly every page on the web? Generally speaking, the default for a scrollbar is almost always hidden unless the content requires it to be there.

I definitely agree it's trivial for a dev to override, but it seems to be an odd default in my opinion, which is why I initially opened this issue. If this is indeed intended and the way you'd like to keep it, feel free to close this issue.

Thanks :)

@DedDorito
Copy link
Author

DedDorito commented Aug 3, 2017

I don't understand that last part.

@johnleider https://vuetifyjs.com/components/dialogs (open a dialog as an example) Navigation drawers, dialogs, and other components automatically have overflow hidden, so the current behavior (default being to force the scrollbar) actually causes that constant jarring with the viewport width jumping back and forth.

@johnleider
Copy link
Member

After speaking with the backers and devs, the consensus is to leave it as it is and allow the user to change it.

@johnleider johnleider added wontfix The issue is expected and will not be fixed and removed T: feature A new feature labels Aug 4, 2017
@johnleider johnleider self-assigned this Aug 4, 2017
@CharlesOkwuagwu
Copy link
Contributor

CharlesOkwuagwu commented Aug 30, 2017

Hi, maybe we should include an example of how best to disable the scrollbar, for those who need it, as part of the FAQ.

Presently, the FAQ Question:

The scrollbar is showing even though my content is not overflowing vertically.

has as this Answer:

Vuetify by default turns on the html scrollbar. This is a design choice and has been debated numerous times. There are pros and cons to having and not having it and as of now, the vote is in favor of leaving it as is.

The present answer does help those looking for HOW to disable the scrollbar

@GeorgeZoum
Copy link

There are a few ways to have the scrollbar added or removed
::-webkit-scrollbar {
width: 1em;
background: yellow;
display: inline !important;
}

adding this, and adjusting the width to 0, for example, will remove the scroll bar, then, if you want to add or remove a scrollbar within a container, you would add it to it specifically
#thiscontainer ::-webkit-scrollbar {
width: 1em;
background: yellow;
display: inline !important;
}
Additional information on here

[https://www.w3schools.com/howto/howto_css_custom_scrollbar.asp]

cest-tout added a commit to cest-tout/printemps that referenced this issue Jun 27, 2019
add vuetify to vue object
add a style for html to remove overflow-y scroll
ref: vuetifyjs/vuetify#1197
@Dirvann
Copy link

Dirvann commented Jul 31, 2019

The problem is in the html element having the overflow-y:scroll css.

To remove the scrollbar add overflow-y:hidden as style to html and it's solved

example: <html style="overflow-y: hidden;"> in the index.html file

@LeeGrobler
Copy link

LeeGrobler commented May 22, 2020

Vuetify by default turns on the html scrollbar. This is a design choice and has been debated numerous times. There are pros and cons to having and not having it and as of now, the vote is in favor of leaving it as is.

I can think of literally no "pros" to having overflow-y: scroll over overflow-y: auto as the default behaviour. Perhaps we can be enlightened on some of these pros?

And I agree that the lack of a standardized way of overriding this behaviour is a problem. What I ended up doing was adding the following to my public/index.html's head:

    <style>
      html { overflow-y: auto !important; }
    </style>

Which sucks, of course, because why is the framework forcing me to use !important

@klarkc
Copy link

klarkc commented Nov 4, 2020

This style brokes iframe default behavior, causing double scrolling bars, I had a lot of try-errors until I find this global style being the source of the problem. This behavior should not be default because of these kind of side-effects which are not visible.

For anyone having the same issue:

<template>
  <iframe
    frameborder="0"
    src="..."
    scrolling="no"
  />
</template>

<style>
html {
  overflow-y: hidden !important;
}
</style>

<style scoped>
iframe {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
</style>

@KaelWD KaelWD reopened this Sep 13, 2024
@KaelWD KaelWD added T: enhancement Functionality that enhances existing features framework Issues and Feature Requests that have needs framework-wide. and removed wontfix The issue is expected and will not be fixed labels Sep 13, 2024
@KaelWD KaelWD added this to the v4.0.0 (Goliath) milestone Sep 13, 2024
@vuetifyjs vuetifyjs unlocked this conversation Sep 13, 2024
@KaelWD KaelWD self-assigned this Sep 13, 2024
@KaelWD
Copy link
Member

KaelWD commented Sep 13, 2024

I don't see any reason to leave this in anymore, dialogs add padding to make up for missing scrollbars now:

const scrollbarWidth = window.innerWidth - document.documentElement.offsetWidth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework Issues and Feature Requests that have needs framework-wide. T: enhancement Functionality that enhances existing features
Projects
None yet
Development

No branches or pull requests

9 participants