material icon indicating copy to clipboard operation
material copied to clipboard

md-tooltip documentation has invalid example

Open kimmoah opened this issue 11 years ago • 8 comments

I am trying to use tooltip with icon, but seems that it is not working. Am I doing wrong? This is the example that I am using.

        <md-icon md-svg-src="foo.svg" ng-if="type==foo">
          <md-tooltip>This is Foo</md-tooltip>
        </md-icon>

Thanks!

kimmoah avatar Apr 02 '15 01:04 kimmoah

Yes, I understand how important a demo is. But, unfortunately, I couldn't do it because I only know using "md-icon" with URL, but I couldn't find a demo site supporting to read external image file. Do you have any idea how to create a demo for it?

At least, I tried to load angular material and show tooltip with button. http://jsfiddle.net/kimmoah/83yw8hws/

Thanks, Youngjin

kimmoah avatar Apr 02 '15 04:04 kimmoah

ACTUAL PROBLEM: The documentation in tooltip.js has:

 <md-icon icon="/img/icons/ic_play_arrow_24px.svg">
   <md-tooltip>
     Play Music
   </md-tooltip>
 </md-icon>

But it is not valid for md-icon to have any content (it works like an img tag).

jelbourn avatar Apr 02 '15 20:04 jelbourn

@programmist - Tooltips for icons make total sense. Since we do not replace the <md-icon> container, we could transclude the <md-tooltip> content.

ThomasBurleson avatar Apr 02 '15 22:04 ThomasBurleson

@ThomasBurleson md-icon shouldn't do anything with content; it should behave just like an <img> element.

jelbourn avatar Apr 02 '15 22:04 jelbourn

The UX of a icon button with a tooltip makes total sense. But that is really just implemented as:

<md-button>
    <md-icon md-svg-src="your/icon.svg"></md-icon>
    Action #1
    <md-tooltip> My Action Tip</md-tooltip>
</md-button>

So let's mark this as will not fix issue.

ThomasBurleson avatar Apr 02 '15 23:04 ThomasBurleson

The only drawback of wrapping in is that the icon becomes clickable. And, once it is clicked, the tooltip does not go-away when a mouse is out. I think this is not great for UX.

kimmoah avatar Apr 02 '15 23:04 kimmoah

That is a separate tooltip-related issue, which is tracked in #1968. It's worth noting that hover-only tooltips are bad UX for people who can't use the mouse or trackpad. It would be better to persist focus only for true keyboard interactions and exclude mouse clicks, a major pain with browsers but something we're working on for multiple components (buttons, checkboxes and radio buttons).

marcysutton avatar Apr 02 '15 23:04 marcysutton

I could see a scenario where tooltip could optionally be applied as an attribute and behave as a decorator, but that may be beyond the scope of what was intended for tooltip.

programmist avatar Apr 02 '15 23:04 programmist