Scroll bar problem when window's content changed

Hello friends,

I’m having a problem when changing the contents of the window. At first, the vertical scroll bar is automatically displayed (this is expected). When I change the content, the scroll bar is hidden (this is expected). When I return to the previous contents, the vertical scrollbar overlaps the content (and the horizontal bar appears). If I resize the browser window, the “View” size is updated with the vertical scroll bar width and the horizontal bar disappears. But the content change is not firing this. With the following code, we can reproduce the problem:


public class VaadinApp extends Application {
	private void goToPage01(final Window window) {
		VerticalLayout page01 = new VerticalLayout();

		Button button01 = new Button("goToPage02", new ClickListener() {
			public void buttonClick(ClickEvent pEvent) {
				goToPage02(window);
			}
		});

		page01.addComponent(button01);

		final Table table01 = new Table();
		table01.setWidth("100%");
		table01.setHeight("2000px");
		table01.addContainerProperty("Test", String.class, null);

		page01.addComponent(table01);

		window.setContent(page01);
	}

	private void goToPage02(final Window window) {
		VerticalLayout page02 = new VerticalLayout();

		Button button02 = new Button("goToPage01", new ClickListener() {
			public void buttonClick(ClickEvent pEvent) {
				goToPage01(window);
			}
		});

		page02.addComponent(button02);

		final Table table02 = new Table();
		table02.setWidth("100%");
		table02.setHeight("100px");
		table02.addContainerProperty("Test 2", String.class, null);
		page02.addComponent(table02);

		window.setContent(page02);
	}

	@Override
	public void init() {
		final Window window = new Window();
		window.setSizeFull();
		setMainWindow(window);

		goToPage01(window);
	}
}

Thank you all!

Best regards,
Bruno Queiroga.

Please, someone help me?

Best regards,
Bruno Queiroga.

Seems like an error in your layout.

Add ?debug to your URL in order to get the debug window and then choose “Analyse layouts” (or “AL” on newer versions) read on the errors it displays and fix them.

Looking quickly at your code, it seems like you are adding 100% wide components into vertical layouts with undefined size.

Layouts analyzed on server, total top level problems: 0


Processing time was 18ms for 1468 characters of JSON
Referenced paintables: 4

The vertical layout default width is 100% (isn’t undefined). If it is possible, I ask you to perform this simple test to check if the problem occurs. Thank you.

Best regards,
Bruno Queiroga.

I tried your code and indeed it looks like some kind of bug.

I think you should open a ticket for this and attach the code sample to it for the devs to take a better look at it.