feat(ui5-toolbar-item): add shrink-content property - #13883
Conversation
|
🚀 Deployed on https://pr-13883--ui5-webcomponents-preview.netlify.app |
👋 Heads-up: dev close is in effectThanks for the contribution! This repository is currently in dev close ahead of release This PR appears to introduce public-API changes (detected by diffing the Custom Elements Manifest against the latest published version on npm):
Could you please hold off on merging into If this change must ship in the current release, please request a review from one or two members of @UI5/ui5-team-webc so the team can sign off explicitly.
Posted automatically by the Dev Close Notice workflow. |
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