HTML body's width attribute messing with native scrollbars of desktop googl

I’ve been forced to use this ugly code:

.style.width = \"100%\"");

I had to use that because the vertical layout I was using as UI was extending past the HTML body’s width when the vertical scrollbar of the navigator appeared.

The class I was using looked something like that:

public class PatientDetailsView extends VerticalLayout implements HasUrlParameter<Integer> {

Am I making some mistake? Is there an easier workaround?


If you’re using Vaadin 10, then by default, the height and width of the body is set to 100vh and 100vw respectively.

In your main stylesheet, you can set the body’s width. For example:


@Viewport("width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes")
public class MainLayout extends Div implements RouterLayout, PageConfigurator {


    body {
      width: 100%;