Skip to content

BreadcrumbsItem.setText removes the prefix component #9533

Description

@sissbruecker

Description

BreadcrumbsItem can have a prefix component (for example an icon) set with
setPrefixComponent. It also has setText to change the item's text. If you call setText after a prefix has been set, the prefix is removed as setText replaces all content of the item.

This is different from Button and Badge, which have custom implementations that preserve content in other slots when calling setText. SideNavItem does not use HasText, but has a custom setLabel method.

Expected outcome

Setting the text should only change the text. The prefix component should stay.

Minimal reproducible example

BreadcrumbsItem item = new BreadcrumbsItem("Inbox (2 items)");
item.setPrefixComponent(new Icon(VaadinIcon.ENVELOPE));

item.setText("Inbox (3 items)");

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions