Skip to content

Commit f3e2d88

Browse files
authoredMay 14, 2024
fix(ui5-side-navigation-item): click event is no longer fired twice (#8958)
Fixes: #8692

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed
 

‎packages/fiori/src/SideNavigationSelectableItemBase.ts

+2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ class SideNavigationSelectableItemBase extends SideNavigationItemBase {
162162
}
163163

164164
_activate(e: KeyboardEvent | PointerEvent) {
165+
e.stopPropagation();
166+
165167
if (this.isOverflow) {
166168
this.fireEvent("click");
167169
} else {

‎packages/fiori/test/pages/SideNavigation.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
<ui5-side-navigation-sub-item text="Others"></ui5-side-navigation-sub-item>
5555
</ui5-side-navigation-item>
5656
<ui5-side-navigation-item disabled id="item1" text="Home" icon="home" title="Home tooltip"></ui5-side-navigation-item>
57+
<ui5-side-navigation-item id="toggle" text="Toggle" icon="menu"></ui5-side-navigation-item>
5758

5859
<!-- Fixed Items -->
5960
<ui5-side-navigation-item id="fixedItem1" slot="fixedItems" text="Useful Links" icon="chain-link" title="Useful links tooltip">
@@ -96,8 +97,12 @@
9697
sideNavigation.collapsed = !sideNavigation.collapsed;
9798
});
9899

100+
document.getElementById("toggle").addEventListener("click", () => {
101+
sideNavigation.collapsed = !sideNavigation.collapsed;
102+
});
103+
99104
document.querySelectorAll("ui5-side-navigation-item").forEach(function (item) {
100-
item.addEventListener("ui5-click", function (event) {
105+
item.addEventListener("click", function (event) {
101106
clickInput.value = ++clickCounter;
102107
});
103108
});

‎packages/fiori/test/specs/SideNavigation.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ describe("Component Behavior", () => {
226226

227227
// fixed items
228228
assert.strictEqual(await sideNavigationFixedTree.getAttribute("aria-roledescription"), roleDescription, "Role description of the SideNavigation fixed tree element is correctly set");
229-
assert.notExists(await items[8].getAttribute("aria-roledescription"), "Role description of the SideNavigation fixed tree item is not set");
230-
assert.strictEqual(await items[8].getAttribute("aria-haspopup"), "tree", "There is 'aria-haspopup' with correct value");
231-
assert.notExists(await items[9].getAttribute("aria-haspopup"), "There is no 'aria-haspopup'");
229+
assert.notExists(await items[9].getAttribute("aria-roledescription"), "Role description of the SideNavigation fixed tree item is not set");
230+
assert.strictEqual(await items[9].getAttribute("aria-haspopup"), "tree", "There is 'aria-haspopup' with correct value");
231+
assert.notExists(await items[10].getAttribute("aria-haspopup"), "There is no 'aria-haspopup'");
232232

233233
// popup
234234
await browser.$("#item2").click();

0 commit comments

Comments
 (0)
Please sign in to comment.