Skip to content

Conversation

@PetyaMarkovaBogdanova
Copy link
Contributor

@PetyaMarkovaBogdanova PetyaMarkovaBogdanova commented Sep 2, 2025

feat(ui5-toolbar-item): Refactor to a physical item for enhanced overflow logic

The ui5-toolbar-item has been refactored from an abstract item to a physical item, enabling the transfer of logic for overflowPriority and preventOverflowClosing directly to it.

Key Enhancements:

  • Universal Wrapping: The ui5-toolbar-item can now wrap all types of components, allowing them to participate in the overflow toolbar logic seamlessly.
  • Pre-defined Wrappers: For certain components, pre-defined wrappers are available. A console warning is displayed to encourage their use when applicable.
  • 100% Expansion in Overflow: Components that need to expand fully in the overflow popover can now implement the expandInOverflow property.
  • Self Overflow Logic: Components with internal overflow logic can implement the selfOverflowed property.

This enhancement improves flexibility and ensures better integration of components within the overflow toolbar logic.

@github-actions github-actions bot added the Stale label Oct 8, 2025
@github-actions github-actions bot removed the Stale label Oct 10, 2025
@github-actions github-actions bot added the Stale label Oct 31, 2025
@github-actions github-actions bot closed this Nov 7, 2025
@ui5-webcomponents-bot
Copy link
Collaborator

ui5-webcomponents-bot commented Nov 10, 2025

🧹 Preview deployment cleaned up: https://pr-12243--ui5-webcomponents.netlify.app

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview November 10, 2025 10:02 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview November 10, 2025 10:02 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview December 2, 2025 12:47 Inactive
@NakataCode NakataCode self-requested a review December 9, 2025 12:00
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview December 9, 2025 13:34 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview December 10, 2025 09:06 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview December 16, 2025 08:50 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 6, 2026 17:20 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 6, 2026 17:30 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 7, 2026 17:36 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 8, 2026 07:00 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 8, 2026 07:44 Inactive
@ui5-webcomponents-bot
Copy link
Collaborator

ui5-webcomponents-bot commented Jan 8, 2026

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 8, 2026 07:55 Inactive

interface IOverflowToolbarItem extends HTMLElement {
eventsToCloseOverflow?: string[] | undefined;
_selfOverflowed?: boolean | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename?

overflowCloseEvents
hasOverflow


// Method called by ui5-toolbar to inform about the existing toolbar wrapper
checkForWrapper() {
const tagName = this.item?.[0]?.localName as keyof typeof this.predefinedWrapperSet;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tag name should be calculated from the constructor's metadata. Like we do in getClosingEvents. Perhaps let's move to a dedicated getter get itemTagName

@@ -0,0 +1,8 @@
/* This style we need for the element inside Popover to not fire the click event on empty space */
:host([is-overflowed]:not([expand-in-overflow])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might not be needed once we make everything 100% or since we removed the wrapper div around the slot

*/

@property({ type: Boolean })
expandInOverflow: boolean = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this, shoudn't everything be 100%, what components should not be full width in popover?

_isRendering = true;
_maxWidth = 0;
fireCloseOverflowRef = this.fireCloseOverflow.bind(this);
_kind = "ToolbarItem";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this. Dedicated wrappers are not populating a slot

</div>
);
}
const separatorClass = item.isSeparator ? " ui5-tb-separator ui5-tb-separator-in-overflow" : "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be jsx dynamic class

* @since 2.19.0
*/
@property({ type: Boolean })
_selfOverflowed: boolean = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a getter, as it's not used in CSS, nor its ever set outside rerendering phase?

get hasOverflow() {
 return this.items?.[0].hasOverflow
}

@slot({
"default": true, type: HTMLElement, invalidateOnChildChange: true,
})
item!: IOverflowToolbarItem[]; // here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment // here


// We want to close the overflow popover, when closing event is being executed
getClosingEvents(): string[] {
const ctor = this.getSlottedNodes<IOverflowToolbarItem>("item")[0]?.constructor as typeof ToolbarItem;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as typeof UI5Element

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants