Skip to content

Commit 4338d56

Browse files
authored
feat(ui5-shellbar): enable tooltips of custom icons (#1863)
Changes: - enable tooltips for custom shellbar items - set tooltips for the built-in icons: search, notifications, profile, products and oveflow - fix count stopped displaying after replacing ui5-icon with ui5-button FIXES: #1854
1 parent 9616872 commit 4338d56

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

packages/fiori/src/ShellBar.hbs

+6
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
data-ui5-notification-count="{{notificationCount}}"
9393
@click={{_handleSearchIconPress}}
9494
aria-label="{{_searchText}}"
95+
title="{{_searchText}}"
9596
._buttonAccInfo="{{accInfo.search}}"
9697
></ui5-button>
9798
{{/if}}
@@ -102,6 +103,7 @@
102103
style="{{this.style}}"
103104
class="{{this.classes}}"
104105
icon="{{this.icon}}"
106+
title="{{this.title}}"
105107
data-count="{{this.count}}"
106108
data-ui5-notification-count="{{../notificationCount}}"
107109
data-ui5-external-action-item-id="{{this.refItemid}}"
@@ -119,6 +121,7 @@
119121
data-ui5-notification-count="{{notificationCount}}"
120122
@click={{_handleNotificationsPress}}
121123
aria-label="{{_notificationsText}}"
124+
title="{{_notificationsText}}"
122125
._buttonAccInfo="{{accInfo.notifications}}"
123126
></ui5-button>
124127
{{/if}}
@@ -130,6 +133,7 @@
130133
icon="sap-icon://overflow"
131134
@click="{{_handleOverflowPress}}"
132135
aria-label="{{_overflowText}}"
136+
title="{{_overflowText}}"
133137
._buttonAccInfo="{{accInfo.overflow}}"
134138
></ui5-button>
135139

@@ -140,6 +144,7 @@
140144
@click={{_handleProfilePress}}
141145
style="{{styles.items.profile}}"
142146
aria-label="{{_profileText}}"
147+
title="{{_profileText}}"
143148
._buttonAccInfo="{{accInfo.profile}}"
144149
class="ui5-shellbar-button ui5-shellbar-image-button">
145150
<slot
@@ -157,6 +162,7 @@
157162
data-ui5-text="Product Switch"
158163
@click={{_handleProductSwitchPress}}
159164
aria-label="{{_productsText}}"
165+
title="{{_productsText}}"
160166
._buttonAccInfo="{{accInfo.products}}"
161167
></ui5-button>
162168
{{/if}}

packages/fiori/src/ShellBar.js

+1
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,7 @@ class ShellBar extends UI5Element {
760760
show: true,
761761
press: this._handleCustomActionPress.bind(this),
762762
custom: true,
763+
title: item.title,
763764
};
764765
}),
765766
{

packages/fiori/src/themes/ShellBar.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ slot[name="profile"] {
326326
}
327327

328328
:host([notification-count]) .ui5-shellbar-bell-button::before,
329-
ui5-icon[data-count]::before {
329+
.ui5-shellbar-button[data-count]::before {
330330
position: absolute;
331331
width: auto;
332332
height: 1rem;
@@ -350,7 +350,7 @@ ui5-icon[data-count]::before {
350350
content: attr(data-ui5-notification-count);
351351
}
352352

353-
ui5-icon[data-count]::before {
353+
.ui5-shellbar-button[data-count]::before {
354354
content: attr(data-count);
355355
}
356356

packages/fiori/test/pages/ShellBar.html

+9-9
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@
6969
secondary-title="Second Title"
7070
id="shellbarwithitems"
7171
>
72-
<ui5-shellbar-item icon="accelerated" text="Hello World!"></ui5-shellbar-item>
73-
<ui5-shellbar-item icon="accept" text="Hello World!"></ui5-shellbar-item>
74-
<ui5-shellbar-item icon="alert" text="Hello World!"></ui5-shellbar-item>
75-
<ui5-shellbar-item icon="discussion" text="Hello World!" count="42"></ui5-shellbar-item>
76-
<ui5-shellbar-item icon="error" text="Hello World!"></ui5-shellbar-item>
77-
<ui5-shellbar-item icon="hello-world" text="UI5 Webcomponents"></ui5-shellbar-item>
78-
<ui5-shellbar-item icon="laptop" text="UI5 Webcomponents"></ui5-shellbar-item>
79-
<ui5-shellbar-item icon="nutrition-activity" text="UI5 Webcomponents"></ui5-shellbar-item>
80-
<ui5-shellbar-item icon="sound-loud" text="UI5 Webcomponents"></ui5-shellbar-item>
72+
<ui5-shellbar-item icon="accelerated" text="Hello World!" title="Schedule"></ui5-shellbar-item>
73+
<ui5-shellbar-item icon="accept" text="Hello World!" title="Approve"></ui5-shellbar-item>
74+
<ui5-shellbar-item icon="alert" text="Hello World!" title="Warning"></ui5-shellbar-item>
75+
<ui5-shellbar-item icon="discussion" text="Hello World!" count="42" title="42 Messages"></ui5-shellbar-item>
76+
<ui5-shellbar-item icon="error" text="Hello World!" title="Attention"></ui5-shellbar-item>
77+
<ui5-shellbar-item icon="hello-world" text="UI5 Webcomponents" title="hello world"></ui5-shellbar-item>
78+
<ui5-shellbar-item icon="laptop" text="UI5 Webcomponents" title="Laptop"></ui5-shellbar-item>
79+
<ui5-shellbar-item icon="nutrition-activity" text="UI5 Webcomponents" title="Apple"></ui5-shellbar-item>
80+
<ui5-shellbar-item icon="sound-loud" text="UI5 Webcomponents" title="Sound"></ui5-shellbar-item>
8181
</ui5-shellbar>
8282

8383
<ui5-shellbar

0 commit comments

Comments
 (0)