Skip to content

Commit 4cd86b1

Browse files
authored
refactor(ui5-shellbar-item): rename "item-click" to "click" (#4282)
Change event name from "item-click" to "click" as it belongs to the ShellBarItem, not the ShellBar and using "item" in the event's name does not make sense and this is also the rule we used throughout the major API change activity in RC.15. BREAKING CHANGE: ShellBarItem's event "item-click" has been renamed to "click".
1 parent 3289da4 commit 4cd86b1

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

packages/fiori/src/ShellBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ class ShellBar extends UI5Element {
729729
return this.shadowRoot.querySelector(`#${refItemId}`);
730730
});
731731

732-
const prevented = !shellbarItem.fireEvent("item-click", { targetRef: event.target }, true);
732+
const prevented = !shellbarItem.fireEvent("click", { targetRef: event.target }, true);
733733

734734
this._defaultItemPressPrevented = prevented;
735735
}

packages/fiori/src/ShellBarItem.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ const metadata = {
4343
/**
4444
* Fired, when the item is pressed.
4545
*
46-
* @event sap.ui.webcomponents.fiori.ShellBarItem#item-click
46+
* @event sap.ui.webcomponents.fiori.ShellBarItem#click
4747
* @allowPreventDefault
4848
* @param {HTMLElement} targetRef DOM ref of the clicked element
4949
* @public
50+
* @native
5051
*/
51-
"item-click": {
52+
"click": {
5253
detail: {
5354
targetRef: { type: HTMLElement },
5455
},

packages/fiori/test/pages/ShellBar.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ <h3>ShellBar in Compact</h3>
213213
<ui5-shellbar-item icon="discussion" count="2" id="test-invalidation-item"/>
214214
</ui5-shellbar>
215215

216+
<ui5-toast id="wcToastTC">Custom Action Fired</ui5-toast>
217+
216218
<script>
217219
mySearch.addEventListener("suggestionItemSelect", function (event) {
218220
 console.log(event);
@@ -269,14 +271,14 @@ <h3>ShellBar in Compact</h3>
269271
});
270272

271273
Array.from(document.querySelectorAll("ui5-shellbar-item")).forEach(function(item) {
272-
item.addEventListener("item-click", function(event) {
273-
console.log(event.detail.targetRef);
274+
item.addEventListener("ui5-click", function(event) {
275+
wcToastTC.show();
274276
});
275277
});
276278

277279
["disc", "call"].forEach(function(id) {
278280
var currenItem = window[id][0] || window[id];
279-
currenItem.addEventListener("ui5-itemClick", function(event) {
281+
currenItem.addEventListener("ui5-click", function(event) {
280282
event.preventDefault();
281283
window["press-input"].value = event.target.id;
282284
window["custom-item-popover"].showAt(event.detail.targetRef);

0 commit comments

Comments
 (0)