I have a shared component using Vuetify's v-tooltip, and it works perfectly when hovering with the mouse. However, when I use the tap button to access a button that has the tooltip, it doesn't work. Can someone help me troubleshoot this issue?
Here's the code for my tooltip component:
<template>
<v-tooltip
v-bind="$attrs"
:open-on-focus="true"
:content-class="`${tooltipClass} custom-tooltip ${color} darken-2`"
open-delay="250"
max-width="288px"
>
<template v-slot:activator="{ on, attrs }">
<div v-bind="attrs" v-on="on">
<slot />
</div>
</template>
<span class="tooltip-text">{{ getTooltipText() }}</span>
</v-tooltip>
</template>
And here's how I use it:
<tooltip
tooltip-text="edit metadata"
bottom
position="bottom"
>
<EditExternalButton
:external-link="item.editLink"
:data-test="`result-list-item-edit-external-${i + 1}`"
event-name-string="metadata_edit clicked"
/>
</tooltip>
I tried to add
:open-on-focus="true"
in props but it didn't work
A regular div usually cannot be focused, so you'll never reach it through the keyboard and the handler won't be triggered.
There are several ways around it:
tabindex="0"
to the div to make it tabbable: