ionicons icon indicating copy to clipboard operation
ionicons copied to clipboard

Disabling default tooltips

Open franciscojdev opened this issue 4 years ago • 7 comments

When I hover over an icon, the default tooltip shows up on the bottom right. Is there any way to disable this ? "pointer-events: none" works but it disables my hover animations. tooltip

franciscojdev avatar Mar 11 '21 20:03 franciscojdev

It seems to be directly coming from the svg https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title

Siedlerchr avatar Mar 15 '21 11:03 Siedlerchr

So, in this case, how do I go into the svg to change it ? Because I don't have them downloaded, I have them in my HTML through the code provided in the ion-icons website. Thanks :)

franciscojdev avatar Mar 15 '21 13:03 franciscojdev

"pointer-events: none" works but it disables my hover animations.

if you put the hover on the parent element and not the ion-icon element the color change should still work.

martinklepsch avatar Apr 12 '21 12:04 martinklepsch

Would really appreciate a way to disable the tooltip as well. I definitely don't want a tooltip every time I place one of these, since in many cases the icon is the root element for a custom (complex) tooltip or other functionality.

ariscol avatar Apr 15 '21 19:04 ariscol

Tooltip comes from the <title>....</title> inside the <svg/>.

Question is: do we need the title for any reason, like accessibility? or is the title irrelevant?

If irrelevant, then can't we "just" remove it?

If yes, can be removed, then I guess it can be removed in the build script.

p.s.: <title>${svgData.title}</title> is the svg source file filename.

peterpeterparker avatar May 13 '21 15:05 peterpeterparker

It seems to me that if good accessibility were a motivator, you'd be even more obligated to provide a way to remove/disable/override the title, because in many cases the name of the icon may be confusing or even misleading. Accessibility can only be effectively supported by the site designer, and these titles, quite literally, get in the way of that effort.

Oh, and another reason I think it's a bad idea to have the title in the SVG: Internationalization.

ariscol avatar May 14 '21 01:05 ariscol

I got around the hover tooltip with CSS:

ion-icon:before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
}

Doesn't resolve any accessibility issues that may be caused by having a non-applicable title tag, but it at least prevents the tooltip from being triggered without impacting other hover effects (at least none that I'm using).

kaigon avatar Jun 11 '21 19:06 kaigon

Thanks for the issue, closing this to track in #838.

brandyscarney avatar Sep 27 '22 19:09 brandyscarney

I got around the hover tooltip with CSS:

ion-icon:before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
}

Doesn't resolve any accessibility issues that may be caused by having a non-applicable title tag, but it at least prevents the tooltip from being triggered without impacting other hover effects (at least none that I'm using).

@kaigon Thank you so much. This solved it for me 😌🙏.

SurajanShrestha avatar May 23 '23 11:05 SurajanShrestha