Skip to content

[tabsheet] Loading animation is not removed from TabSheet after removing the last tab #10210

@TatuLund

Description

@TatuLund

Description

When all tabs are removed from a TabSheet, the component displays the loading animation .

Expected outcome

Loading animation should not be visible.

Minimal reproducible example

@Route("tabs-demo")
public class TabsDemoView extends VerticalLayout {

	private static final long serialVersionUID = 1L;

	private final TabSheet tabSheet = new TabSheet();
	private int tabCounter = 1;

	public TabsDemoView() {
		Button addButton = new Button("Add Tab", e -> addTab());
		Button removeButton = new Button("Remove Selected Tab", e -> removeSelectedTab());
		add(addButton, removeButton, tabSheet);
	}

	private void addTab() {
		String tabName = "Tab " + tabCounter;
		VerticalLayout content = new VerticalLayout(new Text("This is content for " + tabName));
		tabSheet.add(tabName, content);
		tabCounter++;
	}

	private void removeSelectedTab() {
		var selected = tabSheet.getSelectedTab();
		if (selected != null) {
			tabSheet.remove(selected);
		}
	}
}

Steps to reproduce

Use the sample code, remove the tabs by clicking the button.

Environment

Vaadin version(s): ?

Browsers

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions