vaadin / vaadin/framework

Window resized by TabSheet, can get cut off

Open
#5,865 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Stale v7
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Originally by mdiamond


I have a tabsheet in a sub-window. If the browser window is too small for it when the window is first brought up, switching tabs can cause the window to recalculate its size incorrectly.

Steps to repro (using the DemoWindow code below):

  1. Resize the browser to be too small to show the whole sub-window.
  2. Call up the sub-window.
  3. Note that the sub-window's bottom corners are rounded, showing that the window has sized itself correctly to the browser window. The scrollbar can be used to see all controls.
  4. Click on the second tab; the scrollbar disappears (as expected). 
  5. Click back to the first tab.
  6. BUG: The bottom of the sub-window is now cut-off. The scrollbar cannot be used to see all controls.
  7. Maximize the window, then restore it. The window size is correct once more, and switching tabs does NOT change its size any more.
public class DemoWindow extends Window {

	static private float PIXEL_WIDTH = 400f;
	static private float PIXEL_HEIGHT = 500f;

	public DemoWindow() {
		super("Demo Window");

		FormLayout layoutTab1 = new FormLayout();
		for (int i = 0; i < 20; i++) {
			layoutTab1.addComponent(new TextField("Field " + i));
		}
		layoutTab1.setMargin(true);
		layoutTab1.setSizeFull();

		FormLayout layoutTab2 = new FormLayout();
		layoutTab2.setMargin(true);
		layoutTab2.setSizeFull();

		TabSheet tabControl = new TabSheet();
		tabControl.addTab(layoutTab1, "Tab 1");
		tabControl.addTab(layoutTab2, "Tab 2");
		tabControl.addStyleName(ValoTheme.TABSHEET_FRAMED);
		tabControl.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
		tabControl.setSizeUndefined();

		VerticalLayout outerFrame = new VerticalLayout();
		outerFrame.addComponent(tabControl);
		outerFrame.setSizeUndefined(); // must be Undefined to get window's scroll bars to appear

		setContent(outerFrame);
		setModal(true);
		setWidth(PIXEL_WIDTH, Unit.PIXELS);
		setHeight(PIXEL_HEIGHT, Unit.PIXELS);
	}
}


Imported from https://dev.vaadin.com/ issue #15180

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the DemoWindow reproduction described in the issue, focusing on Window, TabSheet, and the sizing behavior when switching between tabs. Verify the case where the browser is too small and the window initially shows scrollbars. Done means switching tabs no longer cuts off the sub-window, and maximizing then restoring is not required to correct its size.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.