Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feeqt-rq : Support for HTML in tooltip #5440

Closed
AhsanAyaz opened this issue Jun 30, 2017 · 11 comments
Closed

Feeqt-rq : Support for HTML in tooltip #5440

AhsanAyaz opened this issue Jun 30, 2017 · 11 comments
Assignees

Comments

@AhsanAyaz
Copy link

feature request:

What is the expected behavior?

Tooltip should be able to render HTML for advance/custom tooltips. See attached image as an example.

What is the current behavior?

HTML is not supported inside tooltip

What is the use-case or motivation for changing an existing behavior?

To have dynamic templates under tooltip which is required in some complex applications.

EXAMPLE

screen shot 2017-06-30 at 9 26 01 pm

@julianobrasil
Copy link
Contributor

julianobrasil commented Jun 30, 2017

I think this would be contrary to material design specs which states that:

Tooltips don’t display rich information including images and formatted text.
Tooltips are different than ALT-attributes, which are intended primarily for static images.
Tooltips don’t have directional arrows; instead, they rely on motion emanating from the source to convey direction.

I didn't see anything in the specs like bootstrap's popover, so I'm not sure there will be such a component someday in the official set. But, as soon as CDK is out, probably will be done in community projects.

Anyway, take a look at this discussion: #2691

@AhsanAyaz
Copy link
Author

@julianobrasil
I've already implemented a demo (in the demo app) and the implementation support on my fork.
I didn't want to include another library for the HTML support for my project so i'll probably use my fork in the project. And yes there isn't anything like popover in material.
I might be creating a pull request anyway. You can at least run it and see how that looks :)

AhsanAyaz added a commit to AhsanAyaz/material2 that referenced this issue Jun 30, 2017
add support for custom html inside tooltip. in some projects it is necessary to have custom tooltips and when using angular-material, it’ll be hard to follow. so for flexibility, we should add it.

closes angular#5440
@julianobrasil
Copy link
Contributor

I cloned your feat-tooltip-cust-html, but couldn't see anything different in the tooltip. Have I cloned the wrong branch?

@AhsanAyaz
Copy link
Author

AhsanAyaz commented Jul 1, 2017

@julianobrasil I have changed the src/lib/tooltip/tooltip.ts which can be seen in the changes in the PR. I've also modified the demo of tooltip inside the src/demo-app/tooltip.
After you've cloned the branch, you should be able to do gulp serve:devapp and see two buttons as can be seen in the attachment. One working with our regular old message string and other with html.

screen shot 2017-07-01 at 8 56 20 am

Please let me know if that's not the case.

@julianobrasil
Copy link
Contributor

My mistake. I was building the master instead of the feat-tooltip-cust-html branch. Now I see it. Well, I think the change is nice (although, in the demo page it raises expectations that the html tooltip will change color if you click on the "Toogle tooltipClass" button as it happens with the master branch demo).

The pros:

  • There's no need for a whole new component
  • All you need is a class to make things up and running

The cons:

  • It doesn't follow the material specs (maybe it should be a whole new component for this reason - the official set should stick to the specs as much as possible)

Sugestion:

  • There's no need for the little arrow, as the animation source works as the origin of the popup. As stated in material guide lines for the original tooltip: "(...) rely on motion emanating from the source to convey direction."

@mmalerba
Copy link
Contributor

mmalerba commented Jul 5, 2017

@andrewseguin is this something we want to support in tooltip?

@jelbourn
Copy link
Member

jelbourn commented Jul 7, 2017

When designing the tooltip we deliberately decided not to support this. The Material Design spec is rather prescriptive about only text appearing in tooltips. Rich content also presents a challenge for a11y.

@AT-Rocha
Copy link

AT-Rocha commented Jan 9, 2018

Sorry, I know it is a closed issue, but what about how to implement i18n to mat Tooltip ?
One possible use would be:

<ng-template style="" #inRet i18n="@@groupIncludeYard" >Another Text.</ng-template> <mat-list-item [matTooltip]="inRet" [matTooltipPosition]="'above'" >SOME TEXT </mat-list-item>

Today it returns [object Object] in the Tooltip.

Or there is another way ? Thanks.

@malikfaizanhaider
Copy link

@AhsanAyaz how you add arrow on tooltip?

@tatsujb
Copy link

tatsujb commented Nov 13, 2018

using unicode, on the other hand works.

so there's a lot you can do there including controlling where your text line-breaks with \u00A0 instead of a space.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants