Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
4b9e525
chore(ui5-toolbar): toolbar item wrapper introduced
PetyaMarkovaBogdanova Aug 12, 2025
eb44c13
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Sep 2, 2025
0439ce7
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Sep 2, 2025
7c49aa4
chore(ui5-toolbar-item): wrappers introduced
PetyaMarkovaBogdanova Sep 9, 2025
682adfa
Merge branch 'poc-toolbar-item' of github.com:SAP/ui5-webcomponents i…
PetyaMarkovaBogdanova Sep 9, 2025
a177545
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Sep 9, 2025
6169477
chore(ui5-toolbar-item): toolbar wrappers
PetyaMarkovaBogdanova Sep 10, 2025
6d61c76
chore(ui5-toolbar): toolbar item wrapper introduced
PetyaMarkovaBogdanova Sep 10, 2025
84607fb
chore(ui5-toolbar): toolbar item wrapper introduced
PetyaMarkovaBogdanova Sep 10, 2025
8b60ec7
chore(ui5-toolbar): toolbar item wrapper introduced
PetyaMarkovaBogdanova Sep 10, 2025
433a23b
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Sep 11, 2025
72da995
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Sep 11, 2025
a82c920
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Sep 12, 2025
fed79a5
chore(ui5-toolbar-item): item wrapers introduced
PetyaMarkovaBogdanova Sep 16, 2025
2324db6
Merge branch 'poc-toolbar-item' of github.com:SAP/ui5-webcomponents i…
PetyaMarkovaBogdanova Sep 16, 2025
22648ff
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Sep 16, 2025
669a44a
chore(ui5-toolbar-item): items wrappers introduced
PetyaMarkovaBogdanova Sep 16, 2025
9a12522
chore(ui5-toolbar): toolbar item wrapper introduced
PetyaMarkovaBogdanova Sep 16, 2025
3456ef3
chore(ui5-toolbar): item wrappers introduced
PetyaMarkovaBogdanova Oct 9, 2025
67f676c
fix(ui5-shellbar): adjust sizes-parameters for shellbar
PetyaMarkovaBogdanova Oct 9, 2025
a2f410b
chore(ui5-toolbar): wrappers introduced
PetyaMarkovaBogdanova Nov 10, 2025
ee89f1c
fix(ui5-toolbar): toolbar items introduced
PetyaMarkovaBogdanova Nov 10, 2025
02ec8f9
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Nov 10, 2025
2f3648a
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Nov 10, 2025
83e8288
chore(ui5-toolbar): toolbar wrappers introduced
PetyaMarkovaBogdanova Nov 10, 2025
4a2452a
Merge branch 'poc-toolbar-item' of github.com:UI5/webcomponents into …
PetyaMarkovaBogdanova Nov 10, 2025
d53d294
chore(ui5-toolbar): wrappers introduced
PetyaMarkovaBogdanova Nov 11, 2025
9615fee
chore(ui5-toolbar): toolbarItem wrappers
PetyaMarkovaBogdanova Nov 17, 2025
b429bd6
Merge branch 'main' of github.com:UI5/webcomponents
PetyaMarkovaBogdanova Nov 17, 2025
388ab96
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Nov 17, 2025
079ae12
chore(ui5-toolbar): toolbar wrappers introduced
PetyaMarkovaBogdanova Nov 17, 2025
4ad904b
chore(ui5-toolbar): toolbar item wrapper introduced
PetyaMarkovaBogdanova Nov 18, 2025
180104d
chore(ui5-toolbar-item): wrappers introduced
PetyaMarkovaBogdanova Nov 19, 2025
d8635c5
Merge branch 'main' of github.com:UI5/webcomponents
PetyaMarkovaBogdanova Nov 19, 2025
247cfa0
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Nov 19, 2025
258aa4a
Delete packages/main/test/pages/ToolbarWrappers.html
PetyaMarkovaBogdanova Nov 19, 2025
92b262b
chore(ui5-toolbar): fix tests
PetyaMarkovaBogdanova Nov 19, 2025
492082e
chore(ui5-toolbar): fix click event handling in ToolbarItem
PetyaMarkovaBogdanova Nov 19, 2025
8e44245
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Nov 24, 2025
dced6b4
chore(ui5-toolbar): fix toolbar items
PetyaMarkovaBogdanova Nov 24, 2025
991dcc6
chore(ui5-toolbar): fix OTB width
PetyaMarkovaBogdanova Nov 24, 2025
f302f15
fix(ui5-toolbar): enhance overflow handling and add new toolbar item …
PetyaMarkovaBogdanova Nov 24, 2025
82a3e17
chore(ui5-toolbar): fix reviwe comments
PetyaMarkovaBogdanova Dec 1, 2025
bd388c0
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Dec 1, 2025
b2443a3
chore(ui5-toolbar): fix review comments
PetyaMarkovaBogdanova Dec 2, 2025
9a0b798
Merge branch 'poc-toolbar-item' of github.com:UI5/webcomponents into …
PetyaMarkovaBogdanova Dec 2, 2025
62f3d2d
Merge branch 'main' of github.com:UI5/webcomponents into poc-toolbar-…
PetyaMarkovaBogdanova Dec 2, 2025
d514738
fix(ui5-toolbar): fix tests
PetyaMarkovaBogdanova Dec 2, 2025
a5adb65
chore(ui5-toolbar): review comments
PetyaMarkovaBogdanova Dec 9, 2025
8b3d82a
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Dec 10, 2025
22f6370
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Dec 16, 2025
7ca80af
fix(ui5-toolbar): migrate ToolbarItem to UI5 Web Component
PetyaMarkovaBogdanova Jan 6, 2026
9715c19
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Jan 6, 2026
fff9c29
fix(ui5-toolbar-item): item wrapper introduced
PetyaMarkovaBogdanova Jan 6, 2026
3a9b49d
Merge branch 'poc-toolbar-item' of github.com:UI5/webcomponents into …
PetyaMarkovaBogdanova Jan 6, 2026
a083b75
fix(ui5-toolbar-item): general wrapper introduced
PetyaMarkovaBogdanova Jan 7, 2026
a2bc90b
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Jan 8, 2026
8775ffc
Merge branch 'main' into poc-toolbar-item
PetyaMarkovaBogdanova Jan 8, 2026
30df429
Merge branch 'poc-toolbar-item' of github.com:UI5/webcomponents into …
PetyaMarkovaBogdanova Jan 8, 2026
fc27605
fix(ui5-toolbar-item): remove code from components that is not needed
PetyaMarkovaBogdanova Jan 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 139 additions & 1 deletion packages/main/cypress/specs/Toolbar.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ToolbarSelect from "../../src/ToolbarSelect.js";
import ToolbarSelectOption from "../../src/ToolbarSelectOption.js";
import ToolbarSeparator from "../../src/ToolbarSeparator.js";
import ToolbarSpacer from "../../src/ToolbarSpacer.js";
import type ToolbarItem from "../../src/ToolbarItem.js";
import ToolbarItem from "../../src/ToolbarItem.js";
import add from "@ui5/webcomponents-icons/dist/add.js";
import decline from "@ui5/webcomponents-icons/dist/decline.js";
import employee from "@ui5/webcomponents-icons/dist/employee.js";
Expand Down Expand Up @@ -575,6 +575,7 @@ describe("ToolbarButton", () => {
cy.get("@toolbar").then($toolbar => {
const toolbar = $toolbar[0] as Toolbar;
const addButton = document.getElementById("add-btn") as ToolbarButton;

expect(toolbar.itemsToOverflow.includes(addButton)).to.be.true;

const initialOverflowCount = toolbar.itemsToOverflow.length;
Expand Down Expand Up @@ -664,3 +665,140 @@ describe("ToolbarButton", () => {
.should("contain.text", "Decline Item");
});
});

describe("Toolbar Item", () => {
it("Should render ui5-toolbar-item with correct properties and not suppress events", () => {
// Mount the Toolbar with a ui5-toolbar-item wrapping a web component
cy.mount(
<Toolbar>
<ToolbarItem prevent-overflow-closing overflow-priority="AlwaysOverflow">
<Button id="innerButton" icon="employee">User Menu</Button>
</ToolbarItem>
</Toolbar>
);

// Verify the ui5-toolbar-item has the correct properties
cy.get("ui5-toolbar-item").should((item) => {
expect(item).to.have.attr("prevent-overflow-closing");
expect(item).to.have.attr("overflow-priority", "AlwaysOverflow");
});

// Verify the inner component (ui5-button) is rendered
cy.get("ui5-toolbar-item")
.find("ui5-button").should((button) => {
expect(button).to.exist;
expect(button).to.contain.text("User Menu");
});


// Attach a click event to the inner button
cy.get("ui5-button#innerButton")
.then(button => {
button.get(0).addEventListener("click", cy.stub().as("buttonClicked"));
});

cy.get('ui5-toolbar') // Select the toolbar
.shadow() // Access the shadow DOM of the toolbar
.find('.ui5-tb-overflow-btn') // Find the overflow button inside the shadow DOM
.realClick();

cy.get("ui5-toolbar")
.shadow()
.find("[ui5-popover]")
.as("popover")

cy.get("@popover")
.should("have.prop", "open", true);

// Trigger a click event on the inner button
cy.get("ui5-button#innerButton").realClick();

// Verify the click event was triggered
cy.get("@buttonClicked").should("have.been.calledOnce");
});

it("Should respect prevent-overflow-closing property", () => {
// Mount the Toolbar with constrained width to force overflow
cy.mount(
<div style={{ width: "200px" }}>
<Toolbar>
<ToolbarItem overflow-priority="AlwaysOverflow" prevent-overflow-closing>
<Button id="preventCloseButton" icon="employee">Prevent Close</Button>
</ToolbarItem>
<ToolbarItem overflow-priority="AlwaysOverflow">
<Button id="normalButton" icon="add">Normal Button</Button>
</ToolbarItem>
</Toolbar>
</div>
);

// Wait for overflow processing
cy.wait(500);

// Click the overflow button to open the popover
cy.get("ui5-toolbar")
.shadow()
.find(".ui5-tb-overflow-btn")
.click();

// Verify the popover is open
cy.get("ui5-toolbar")
.shadow()
.find(".ui5-overflow-popover")
.should("have.prop", "open", true);

// Click on the item with prevent-overflow-closing
cy.get("ui5-toolbar-item[prevent-overflow-closing]")
.find("ui5-button")
.click();

// Verify the popover remains open
cy.get("ui5-toolbar")
.shadow()
.find(".ui5-overflow-popover")
.should("have.prop", "open", true);

// Optional: Test that normal items still close the popover
cy.get("ui5-toolbar-item:not([prevent-overflow-closing])")
.find("ui5-button")
.click();

// Verify the popover closes
cy.get("ui5-toolbar")
.shadow()
.find(".ui5-overflow-popover")
.should("have.prop", "open", false);
});

it("Should respect overflow-priority property", () => {
// Mount the Toolbar with multiple ui5-toolbar-items
cy.mount(
<Toolbar>
<ToolbarItem overflow-priority="AlwaysOverflow">
<Button id="highPriorityButton" icon="employee">High Priority</Button>
</ToolbarItem>
<ToolbarItem overflow-priority="NeverOverflow">
<Button id="lowPriorityButton" icon="employee">Low Priority</Button>
</ToolbarItem>
</Toolbar>
);

// Verify the overflow-priority property is respected
cy.get("ui5-toolbar-item[overflow-priority='AlwaysOverflow']")
.should("exist")
.should("have.attr", "overflow-priority", "AlwaysOverflow");

cy.get("ui5-toolbar-item[overflow-priority='NeverOverflow']")
.should("exist")
.should("have.attr", "overflow-priority", "NeverOverflow");

// Simulate overflow behavior and ensure high-priority item remains visible
cy.viewport(300, 1080); // Simulate a smaller viewport
cy.get("ui5-toolbar-item[overflow-priority='NeverOverflow']")
.should("be.visible");

// Ensure low-priority item is hidden or moved to overflow
cy.get("ui5-toolbar-item[overflow-priority='AlwaysOverflow']")
.should("not.be.visible");
});
})
7 changes: 6 additions & 1 deletion packages/main/src/Breadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import BreadcrumbsDesign from "./types/BreadcrumbsDesign.js";
import "./BreadcrumbsItem.js";
import type BreadcrumbsItem from "./BreadcrumbsItem.js";
import type BreadcrumbsSeparator from "./types/BreadcrumbsSeparator.js";
import type { IOverflowToolbarItem } from "./ToolbarItem.js";

import {
BREADCRUMB_ITEM_POS,
Expand Down Expand Up @@ -84,6 +85,7 @@ type FocusAdaptor = ITabbable & {
* - [End] - Navigates to the last item.
* @constructor
* @extends UI5Element
* @implements {IOverflowToolbarItem}
* @public
* @since 1.0.0-rc.15
*/
Expand All @@ -109,7 +111,7 @@ type FocusAdaptor = ITabbable & {
bubbles: true,
cancelable: true,
})
class Breadcrumbs extends UI5Element {
class Breadcrumbs extends UI5Element implements IOverflowToolbarItem {
eventDetails!: {
"item-click": BreadcrumbsItemClickEventDetail,
}
Expand Down Expand Up @@ -642,6 +644,9 @@ class Breadcrumbs extends UI5Element {
get _cancelButtonText() {
return Breadcrumbs.i18nBundle.getText(BREADCRUMBS_CANCEL_BUTTON);
}
get _selfOverflowed() {
return true;
}
}

Breadcrumbs.define();
Expand Down
26 changes: 19 additions & 7 deletions packages/main/src/Toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
import type { UI5CustomEvent } from "@ui5/webcomponents-base";
import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js";
import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
import type { ResizeObserverCallback } from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
Expand Down Expand Up @@ -300,14 +299,30 @@ class Toolbar extends UI5Element {

async onAfterRendering() {
await renderFinished();

this.storeItemsWidth();
this.processOverflowLayout();
this.items.forEach(item => {
item.isOverflowed = this.overflowItems.map(overflowItem => overflowItem).indexOf(item) !== -1;
this.addItemsAdditionalProperties(item);
});
}

addItemsAdditionalProperties(item: ToolbarItem) {
item.isOverflowed = this.overflowItems.indexOf(item) !== -1;
const itemWrapper = this.shadowRoot!.querySelector(`#${item._individualSlot}`) as HTMLElement;
if (item._selfOverflowed && !item.isOverflowed && itemWrapper) {
// We need to set the max-width to the self-overflow element in order ot prevent it from taking all the available space,
// since, unlike the other items, it is allowed to grow and shrink
// We need to set the max-width to none and its position to absolute to allow the item to grow and measure its width,
// then when set, the max-width will be cached and we will set its highest value to not cut it when the Toolbar shrinks it
// on rendering and then we resize it manually.
itemWrapper.style.maxWidth = `none`;
itemWrapper?.classList.add("ui5-tb-self-overflow-grow");
item._maxWidth = Math.max(this.getItemWidth(item), item._maxWidth);
itemWrapper.style.maxWidth = `${item._maxWidth}px`;
itemWrapper?.classList.remove("ui5-tb-self-overflow-grow");
}
}

/**
* Returns if the overflow popup is open.
* @public
Expand Down Expand Up @@ -460,16 +475,13 @@ class Toolbar extends UI5Element {
this.popoverOpen = false;
}

onBeforeClose(e: UI5CustomEvent<Popover, "before-close">) {
e.preventDefault();
}

onOverflowPopoverOpened() {
this.popoverOpen = true;
}

onResize() {
this.closeOverflow();
this.storeItemsWidth();
this.processOverflowLayout();
}

Expand Down
2 changes: 2 additions & 0 deletions packages/main/src/ToolbarButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ class ToolbarButton extends ToolbarItem {
@property()
width?: string;

_kind = "ToolbarButton";

get styles() {
return {
width: this.width,
Expand Down
Loading
Loading