Skip to content

Commit 0d00038

Browse files
authored
Merge pull request #6765 from nextcloud-libraries/backport/6761/stable8
[stable8] refactor: deprecate `Tooltip` directive for accessibility
2 parents 014c93d + 2d6f832 commit 0d00038

5 files changed

Lines changed: 28 additions & 29 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ For this we deprecated the `range` property in favor of three new types for the
2323
Also the `formatter` property is deprecated, instead you can now provide a function to the `format` property,
2424
which will receive a `Date` object and should return the formatted date as a string.
2525

26+
#### `Tooltip` directive
27+
The `Tooltip` directive has been deprecated and will be removed in the future.
28+
In most cases you want to use the native browser tooltips instead by using the native HTML `title` attribute.
29+
In some rare cases where you really need a formatted tooltip `NcPopover` could be used.
30+
31+
```diff
32+
<NcButton
33+
- v-tooltip="title"
34+
+ :title="title"
35+
```
36+
2637
## [v8.24.0](https://github.com/nextcloud-libraries/nextcloud-vue/tree/v8.24.0) (2025-04-02)
2738
[Full Changelog](https://github.com/nextcloud-libraries/nextcloud-vue/compare/v8.23.1...v8.24.0)
2839

src/components/NcAppContent/NcAppDetailsToggle.vue

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
-->
55

66
<template>
7-
<NcButton v-tooltip="title"
7+
<NcButton :aria-label="title"
88
class="app-details-toggle"
99
:class="{ 'app-details-toggle--mobile': isMobile }"
10-
:aria-label="title"
10+
:title="title"
1111
variant="tertiary">
1212
<template #icon>
1313
<ArrowLeft v-if="isRtl" :size="20" />
@@ -17,29 +17,22 @@
1717
</template>
1818

1919
<script>
20-
import NcButton from '../NcButton/index.js'
21-
import { t } from '../../l10n.js'
22-
import Tooltip from '../../directives/Tooltip/index.js'
23-
2420
import { emit } from '@nextcloud/event-bus'
21+
import { useIsMobile } from '../../composables/useIsMobile/index.js'
22+
import { isRtl } from '../../utils/rtl.ts'
23+
import { t } from '../../l10n.js'
2524
2625
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
2726
import ArrowLeft from 'vue-material-design-icons/ArrowLeft.vue'
28-
29-
import { useIsMobile } from '../../composables/useIsMobile/index.js'
30-
import { isRtl } from '../../utils/rtl.ts'
27+
import NcButton from '../NcButton/index.js'
3128
3229
export default {
3330
name: 'NcAppDetailsToggle',
3431
35-
directives: {
36-
tooltip: Tooltip,
37-
},
38-
3932
components: {
40-
NcButton,
4133
ArrowRight,
4234
ArrowLeft,
35+
NcButton,
4336
},
4437
setup() {
4538
return {

src/components/NcModal/NcModal.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ export default {
220220
<div class="icons-menu">
221221
<!-- Play-pause toggle -->
222222
<button v-if="hasNext && enableSlideshow"
223-
v-tooltip.auto="playPauseName"
224223
:class="{ 'play-pause-icons--paused': slideshowPaused }"
225224
class="play-pause-icons"
225+
:title="playPauseName"
226226
type="button"
227227
@click="togglePlayPause">
228228
<!-- Play/pause icons -->
@@ -340,7 +340,6 @@ import GenRandomId from '../../utils/GenRandomId.js'
340340
import NcActions from '../NcActions/index.js'
341341
import NcButton from '../../components/NcButton/index.js'
342342
import Timer from '../../utils/Timer.js'
343-
import Tooltip from '../../directives/Tooltip/index.js'
344343
345344
import ChevronLeft from 'vue-material-design-icons/ChevronLeft.vue'
346345
import ChevronRight from 'vue-material-design-icons/ChevronRight.vue'
@@ -352,19 +351,15 @@ export default {
352351
name: 'NcModal',
353352
354353
components: {
355-
NcActions,
356354
ChevronLeft,
357355
ChevronRight,
358356
Close,
359357
Pause,
360358
Play,
359+
NcActions,
361360
NcButton,
362361
},
363362
364-
directives: {
365-
tooltip: Tooltip,
366-
},
367-
368363
props: {
369364
/**
370365
* Name to be shown with the modal

src/components/NcRichContenteditable/NcRichContenteditable.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ export default {
242242
<div class="rich-contenteditable">
243243
<div :id="id"
244244
ref="contenteditable"
245-
v-tooltip="tooltipString"
246245
:class="{
247246
'rich-contenteditable__input--empty': isEmptyValue,
248247
'rich-contenteditable__input--multiline': multiline,
@@ -261,6 +260,7 @@ export default {
261260
:aria-controls="tributeId"
262261
:aria-expanded="isAutocompleteOpen ? 'true' : 'false'"
263262
:aria-activedescendant="autocompleteActiveId"
263+
:title="tooltipString"
264264
v-bind="$attrs"
265265
v-on="listeners"
266266
@focus="moveCursorToEnd"
@@ -288,7 +288,6 @@ export default {
288288
import { t } from '../../l10n.js'
289289
import NcAutoCompleteResult from './NcAutoCompleteResult.vue'
290290
import richEditor from '../../mixins/richEditor/index.js'
291-
import Tooltip from '../../directives/Tooltip/index.js'
292291
import { emojiSearch, emojiAddRecent } from '../../functions/emoji/index.ts'
293292
import { searchProvider, getLinkWithPicker } from '../NcRichText/index.js'
294293
@@ -312,10 +311,6 @@ smilesCharacters.forEach((char) => {
312311
export default {
313312
name: 'NcRichContenteditable',
314313
315-
directives: {
316-
tooltip: Tooltip,
317-
},
318-
319314
mixins: [richEditor],
320315
321316
inheritAttrs: false,

src/directives/Tooltip/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@ options.themes.tooltip.delay = { show: 500, hide: 200 }
1111
options.themes.tooltip.distance = 10
1212
options.themes.tooltip['arrow-padding'] = 3
1313

14-
export default VTooltip
15-
export { options }
14+
export {
15+
/**
16+
* @deprecated Use the native `title` attribute instead.
17+
*/
18+
VTooltip as default,
19+
options,
20+
}

0 commit comments

Comments
 (0)