feat(ui5-toolbar-item): add shrink-content property - #13883
Open
NakataCode wants to merge 1 commit into
Open
Conversation
NakataCode
temporarily deployed
to
netlify-preview
July 31, 2026 12:52 — with
GitHub Actions
Inactive
NakataCode
requested review from
PetyaMarkovaBogdanova and
dobrinyonkov
and removed request for
dobrinyonkov
July 31, 2026 12:56
|
🚀 Deployed on https://pr-13883--ui5-webcomponents-preview.netlify.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a
ui5-toolbar-itemwithoverflow-priority="NeverOverflow"contains wide content (e.g. aui5-titlewith long text), it pushes other items — including the overflow button — completely out of view. This is because all toolbar item wrappers haveflex-shrink: 0, so nothing yields space.The spec clarifies that the toolbar has no built-in mechanism for long content in small viewports, and
NeverOverflowonly guarantees the item won't go to the popover — it makes no promise about layout when the item exceeds the container width. Titles are also intended to be short control-group labels per the Fiori spec, so automatic shrinking behavior would be surprising and could break existing layouts.Solution
Add an opt-in
shrink-contentboolean property toui5-toolbar-item. When set, the item's wrapper receives the existing.ui5-tb-self-overflowCSS class (flex-shrink: 1; flex-grow: 1; min-width: 2.5rem), allowing it to yield space to other items instead of pushing them out.Implementation details
shrinkContentproperty onToolbarItem— opt-in, defaultfalsehasOverflowgetter returnstruewhenshrinkContentis set, hooking into the existing self-overflow CSS path with no new CSS requiredclampMaxWidthgetter added toToolbarItemBase(returnstrueby default, following the existing behavioral flag pattern ofhasOverflow,isSeparator,ignoreSpaceetc.). Overridden inToolbarItemto return!this.shrinkContent, preventing the max-width capping logic inaddItemsAdditionalPropertiesfrom permanently freezing the item at its first-render widthshrinkContentitems excluded fromminWidthaccumulation instoreItemsWidth— their rendered width is flex-distributed, not a stable natural widthUsage
Fixes #13768