TabSheet: Close all Tabs, Caption is remain without a content

Hello,

In a TabSheet:

  • when many tabs are open,
  • the arrows are visible and
  • the current tab is further back:

then all tabs are closed (for exampe with removeAllComponents()), the caption (of some tabs) remains - without content.

Example code:

final VerticalLayout layout = new VerticalLayout();
final TabSheet sheet = new TabSheet();

for (int i = 1; i < 12; i++)
{
	sheet.addTab(new Label("This is a new Tab"), "Caption of a new Tab with No. "+ i);
}
sheet.setSelectedTab(5);

Button buttonClose = new Button("Close all Tabs");
buttonClose.addClickListener(e -> { sheet.removeAllComponents(); });

layout.addComponents(buttonClose, sheet);

What am I doing wrong?