Skip to content

Commit 0976fad

Browse files
Merge pull request #3569 from nextcloud/enh/3550-Adapt_several_NC_Vue_components_for_work_with_custom_tooltips
Add title prop to components for native tooltips
2 parents 94f2c9a + b089386 commit 0976fad

4 files changed

Lines changed: 28 additions & 4 deletions

File tree

src/components/NcActionLink/NcActionLink.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default {
5353
:href="href"
5454
:aria-label="ariaLabel"
5555
:target="target"
56+
:title="title"
5657
class="action-link focusable"
5758
rel="nofollow noreferrer noopener"
5859
@click="onClick">
@@ -133,6 +134,13 @@ export default {
133134
return ['_blank', '_self', '_parent', '_top'].indexOf(value) > -1
134135
},
135136
},
137+
/**
138+
* Declares a native tooltip when not null
139+
*/
140+
title: {
141+
type: String,
142+
default: null,
143+
},
136144
},
137145
}
138146
</script>

src/components/NcActions/NcActions.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,7 @@ export default {
939939
],
940940
attrs: {
941941
'aria-label': action?.componentOptions?.propsData?.ariaLabel || action?.componentOptions?.children?.[0]?.text,
942+
title: action?.componentOptions?.propsData?.title,
942943
},
943944
ref: action?.data?.ref,
944945
props: {

src/components/NcAppSidebar/NcAppSidebar.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ include a standard-header like it's used by the files app.
195195
<!-- main title -->
196196
<h2 v-show="!titleEditable"
197197
v-linkify="{text: title, linkify: linkifyTitle}"
198-
v-tooltip.auto="titleTooltip"
198+
:aria-label="titleTooltip"
199+
:title="titleTooltip"
199200
class="app-sidebar-header__maintitle"
200201
:tabindex="titleEditable ? 0 : undefined"
201202
@click.self="editTitle">
@@ -231,15 +232,16 @@ include a standard-header like it's used by the files app.
231232
</div>
232233
<!-- secondary title -->
233234
<p v-if="subtitle.trim() !== ''"
234-
v-tooltip.auto="subtitleTooltip"
235+
:aria-label="subtitleTooltip"
236+
:title="subtitleTooltip"
235237
class="app-sidebar-header__subtitle">
236238
{{ subtitle }}
237239
</p>
238240
</div>
239241
</div>
240242
</div>
241243

242-
<NcButton v-tooltip.auto="closeTranslated"
244+
<NcButton :title="closeTranslated"
243245
:aria-label="closeTranslated"
244246
type="tertiary"
245247
class="app-sidebar__close"

src/components/NcAvatar/NcAvatar.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export default {
115115
'avatardiv--unknown': userDoesNotExist,
116116
'avatardiv--with-menu': hasMenu
117117
}"
118+
:title="title"
118119
:style="avatarStyle"
119120
class="avatardiv popovermenu-wrapper"
120121
:tabindex="hasMenu ? '0' : undefined"
@@ -325,6 +326,18 @@ export default {
325326
type: String,
326327
default: null,
327328
},
329+
330+
/**
331+
* Declares a native tooltip when not null
332+
*
333+
* requires disableTooltip not to be set to true
334+
* requires tooltipMessage not to be provided
335+
*/
336+
title: {
337+
type: String,
338+
default: null,
339+
},
340+
328341
/**
329342
* Declares username is not a user's name, when true.
330343
* Prevents loading user's avatar from server and forces generating colored initials,
@@ -445,7 +458,7 @@ export default {
445458
}
446459
},
447460
tooltip() {
448-
if (this.disableTooltip) {
461+
if (this.disableTooltip || this.title) {
449462
return false
450463
}
451464
if (this.tooltipMessage) {

0 commit comments

Comments
 (0)