Skip to content

fix: keep BreadcrumbsItem prefix component when setting text#9534

Merged
web-padawan merged 1 commit into
mainfrom
fix/breadcrumbs-prefix-component
Jun 17, 2026
Merged

fix: keep BreadcrumbsItem prefix component when setting text#9534
web-padawan merged 1 commit into
mainfrom
fix/breadcrumbs-prefix-component

Conversation

@web-padawan

Copy link
Copy Markdown
Member

BreadcrumbsItem.setText used the default HasText#setText, which replaces all of the item's content — so calling it after setPrefixComponent removed the prefix (e.g. an icon).

BreadcrumbsItem item = new BreadcrumbsItem("Inbox (2 items)");
item.setPrefixComponent(new Icon(VaadinIcon.ENVELOPE));
item.setText("Inbox (3 items)"); // icon was lost

The text is now held in a dedicated text node managed through SignalPropertySupport, the same approach Button and Badge use. setText/bindText only update that text node, so the prefix (and any other slotted content) is preserved.

Fixes #9533


🤖 Generated with Claude Code

HasText#setText replaced all of the item's content, removing the prefix
component. Mirror Button and Badge: hold the text in a dedicated text
node managed through SignalPropertySupport, so setText (and bindText)
only updates the text node and leaves the prefix in place.

Fixes #9533

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@web-padawan
web-padawan force-pushed the fix/breadcrumbs-prefix-component branch from 880d88d to 490c6fa Compare June 17, 2026 07:58
@sonarqubecloud

Copy link
Copy Markdown

@web-padawan web-padawan changed the title fix: keep BreadcrumbsItem prefix when setting text fix: keep BreadcrumbsItem prefix component when setting text Jun 17, 2026
@web-padawan
web-padawan added this pull request to the merge queue Jun 17, 2026
Merged via the queue into main with commit f93eabf Jun 17, 2026
15 of 16 checks passed
@web-padawan
web-padawan deleted the fix/breadcrumbs-prefix-component branch June 17, 2026 08:13
ZheSun88 pushed a commit that referenced this pull request Jun 17, 2026
`BreadcrumbsItem.setText` used the default `HasText#setText`, which
replaces all of the item's content — so calling it after
`setPrefixComponent` removed the prefix (e.g. an icon).

```java
BreadcrumbsItem item = new BreadcrumbsItem("Inbox (2 items)");
item.setPrefixComponent(new Icon(VaadinIcon.ENVELOPE));
item.setText("Inbox (3 items)"); // icon was lost
```

The text is now held in a dedicated text node managed through
`SignalPropertySupport`, the same approach `Button` and `Badge` use.
`setText`/`bindText` only update that text node, so the prefix (and any
other slotted content) is preserved.

Fixes #9533

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.2.0-rc1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BreadcrumbsItem.setText removes the prefix component

3 participants