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

feat(tooltip): add support for rich tooltips #2691

Open
QuentinFchx opened this issue Jan 17, 2017 · 43 comments
Open

feat(tooltip): add support for rich tooltips #2691

QuentinFchx opened this issue Jan 17, 2017 · 43 comments
Labels
area: new Issues requesting a new component or area feature This issue represents a new feature or feature request rather than a bug or bug fix intern project! This issue is part of an intern project! https://careers.google.com/students/ P4 A relatively minor issue that is not relevant to core functions

Comments

@QuentinFchx
Copy link

Bug, feature request, or proposal:

Feature request

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

Popovers are not part of the current material design spec, however they are a common component in desktop applications.
It got some traction last year within the angular/material repository here and here.

If this is still not acceptable, what are the alternatives?
I started to hack a bit on the mdDialog, using a custom positioning strategy and custom css for the directional arrow but I'm not sure this is the way-to-go.

Thank you in advance!

@fxck
Copy link
Contributor

fxck commented Jan 18, 2017

Shouldn't be hard, it's basically the same thing as menu, when it comes to positioning and usage of the overlay service, the only difference is that instead of menu items it would have content and buttons. But as you said, it's not part of the spec, so you'd be better off doing it yourself.

I've already mentioned it in some issue, but I think this repo could maintain a curated list of user created components utilising m2's helper services and themes, that meet the quality requirements and standards of this repo.

When I think about it, it would be nice to have a "custom-material2-component-starter" repo, which would include a single component and have everything set up(the way to hook into the themes, services tests etc) along with a guide of requirements, to be considered high quality and worthy of inclusion in the above mentioned list.

Thoughts @jelbourn @devversion ?

@devversion
Copy link
Member

devversion commented Jan 18, 2017

@fxck So you are saying that we should have for each component a single starter repository?

@fxck
Copy link
Contributor

fxck commented Jan 18, 2017

Nope, what I meant is that you could create a "starter" repository that one could clone and create custom material2 component(like popover) with, with everything set up.

Basically this repository slimmed down with different .md files and one example component and material2 as dependency(also addressing the fact that the utility functions would be imported from @angular/material rather than from ../core/rtl/dir for example).

@jelbourn jelbourn added the feature This issue represents a new feature or feature request rather than a bug or bug fix label Jan 27, 2017
@jelbourn
Copy link
Member

We don't have any plans to add / accept a feature like this before 2.0.0 final, though it's something we may explore in the future.

@joejordanbrown
Copy link
Contributor

joejordanbrown commented Jan 28, 2017

@QuentinFchx

I've just created an example popover component, and you can view demo here and the source here it has basic documentation on how to use. If you want to view the demo source you can find that here. It's using most of the menu component with a few things added/removed. It is not complete it was to give you an example. If I have time, I'll rewrite it with more functionality and consistent options naming.

Standard popover

image

image

image

Google+ style popover

image

DEMO

Have a play using the StackBlitz template.

@jelbourn jelbourn added intern project! This issue is part of an intern project! https://careers.google.com/students/ P4 A relatively minor issue that is not relevant to core functions labels Jun 6, 2017
@joejordanbrown
Copy link
Contributor

joejordanbrown commented Jul 16, 2017

After many people contacting me requesting me to publish my demo as a library, I found some time this week to publish it. You can find the GitHub page here https://github.com/material-extended/mde and NPM package here https://www.npmjs.com/package/@material-extended/mde

Have a play using the StackBlitz template.

@honzajde
Copy link

honzajde commented Sep 7, 2017

@joejordanbrown thanks for the nice lib, but thinking about this again - I believe I can do some of the things with dialog and css (maybe I am just naive;) but can not change animations (well, to my knowledge and effort;) - are animations customizable on you popup? Thank you

@joejordanbrown
Copy link
Contributor

joejordanbrown commented Sep 7, 2017

@honzajde thanks. You could, but it's constrained and would not be a popover. A popover is meant to position itself to the target element, and it is also activated via other events than just click, you also have focus trapping that can be disabled if required. The example here shows a few use cases, and I will be pushing an updated demo soon with more advanced examples, like using with form inputs on focus and blur etc.

Currently, it doesn't allow for custom animations, that's more of an Angular problem. I'm sure this will be resolved in the future though. What type of animation was it that you required?

@honzajde
Copy link

honzajde commented Sep 11, 2017

as for the animation - just a simple one but defined by me or my organization, but as long as it looks very 'materially' (and it does) and the speed is ok, I will not need to change it. I hope this popup will make it in some form among standard angular material components. Thx

@fxck
Copy link
Contributor

fxck commented Sep 21, 2017

@jelbourn @mmalerba is anyone actually working on this? Given the intern project tag.

Menu, select, datepicker, autocomplete all could be reusing the same base.

I think menu is closest to the popover component, the problem I see with it is that a lot of logic is actually in the trigger, which only supports click.

@jelbourn
Copy link
Member

Menu, select, datepicker, and autocomplete already share the same base (overlay w/ connected position strategy).

Adding a tooltip-like popup/bubble is on our backlog but isn't scheduled.

@willshowell
Copy link
Contributor

FWIW we've also opened up the popover component we're using internally. It's only depends on the CDK and has a very flexible api.

https://github.com/ncstate-sat/popover

https://stackblitz.com/edit/sat-popover-examples

Hopefully this will help carry some people over until an official Material release.

@elvisbegovic

This comment has been minimized.

@kamok
Copy link

kamok commented Nov 13, 2017

Does anyone have a suggestion for a component, ng material 2 vanilla or custom made, that allows you to set menu position to mouse? For example, I got a really fat table that I want to generate a menu of on click of a row.

Additionally, none of the components I'm looking at have an api that allows for pixel perfect setting in relation to the component that you birth the menu from. If there was, I can just save the mouse position and open the menu at that exact location.

@naivefun
Copy link

@willshowell will your popover component be added to official M2 modules?

@dhniels
Copy link

dhniels commented Feb 16, 2018

Really good thread, I would also throw in my hat for a popover component. PrimeNG has one called OverlayPanel we use very often. Any timeline on when we might see this component in Angular Material?

@priyanshsinghal562
Copy link

This is my simple solution where i emulate a PopOver with Material Design Menu (no extra dependencies
,no cdk, just angular/material). I used this solution in a project for a customer of mine.

https://stackblitz.com/edit/angular2-material-popover

@Misiu
Copy link

Misiu commented Nov 6, 2018

@jelbourn any near future plans about Popover?
I've just check Google Maps and it looks like this kind of control is used there (with that little triangle on top):
googlemaps_popover

While waiting for official implementation I've found this component. Hope this help others.

@mprinc
Copy link

mprinc commented Nov 29, 2018

We don't have any plans to add / accept a feature like this before 2.0.0 final, though it's something we may explore in the future.

Well now the version is a way beyond 2.0.0 :) if I remember that it is to catch-up with angular versioning (?) but, still, any more concrete plans on that?

@maxisam
Copy link

maxisam commented May 20, 2019

just wrap menu into a popover. simple but works in 90% of cases. https://stackblitz.com/github/maxisam/ngx-mat-popover

@w0nderw0man
Copy link

w0nderw0man commented Oct 2, 2019

do we have news? This functional lack is really heartbreaking.
I made mine without any other external librairies.
(and I made an exemple with popover content can be a custom-component)

<mat-icon [matMenuTriggerFor]="menu">{{matIconSelection}}</mat-icon>
<mat-menu #menu="matMenu">
<div mat-menu-item [disableRipple]="true" (click)="$event.stopPropagation()">
<ng-content></ng-content>
</div>
</mat-menu>

a little bit of css, in your css component file :
mat-icon {
cursor: pointer;
}

.mat-menu-item {
height: inherit;
width: inherit;
cursor: default;
}

Just add in your popover component the input :
@Input() matIconSelection: string;

And the example of use :
<home-made-popover [matIconSelection]="'info'"> <div> <div>test</div> <custom-component></custom-component> </div> </home-made-popover>

Result :
image

Hope it can help

@Splaktar
Copy link
Member

Does https://material.angular.io/cdk/overlay/overview meet the needs here?

If not, what is missing? more documentation? a component that simplifies that API and adds Material Design styles?

@LanderBeeuwsaert
Copy link

@Splaktar Hi, a component like you say would be nice. For the moment we use "@ncstate/sat-popover": "4.0.0"

@michaelfaith
Copy link

michaelfaith commented Jul 17, 2020

Does https://material.angular.io/cdk/overlay/overview meet the needs here?

If not, what is missing? more documentation? a component that simplifies that API and adds Material Design styles?

I think that sums it up. Simplified API and more material-esque styling and transition animations. From an api perspective, something similar to the mat-dialog api might be appropriate, allowing the ability to pass components in, and subscribe to closure and action events.

@imkalyan
Copy link

How to change position of popover? And also how to make the popup fixed instead of movement while scrolling?

@fosteman

This comment has been minimized.

@fxck

This comment has been minimized.

@fosteman

This comment has been minimized.

@fxck
Copy link
Contributor

fxck commented Dec 27, 2020

That's because this is the official implementation made by Angular, so they spend a lot of time trying to make it compatible, accessible, well tested, well documented, 100% matching the official spec down to the animation speed (or I guess they try, at the moment every component is basically using outdated specs.) etc. Nothing is really made without a prior big analysis document, all this with a limited team size. A Team that on top of that spends time doing everything but adding new features, like rewriting the whole thing to use mdc web components and team that doesn't really accept community contributions (when it comes to features like this).

So yeah, mui on the other hand has none of this burden. Luckily popover is easy enough to create using cdk, sure official implemention would be nice, but there are community components that are good enough.

@jelbourn
Copy link
Member

jelbourn commented Jan 5, 2021

I should probably write a blog post about this or something, but a big (maybe the biggest) part of what our team spends time on is not breaking downstream apps inside Google. All of google is one massive repo, so every library can only have one version available for the whole company. It's the responsibility of infrastructure teams (us) to not break any applications whenever we merge a change, and it's incredibly easy to "break" someone because most applications have screenshot gold tests, and many have relatively brittle unit tests that assume a certain DOM structure or sync/async behavior. This means that even a change as trivial changing the border-radius on a button takes far more than than most people would expect. Our recent/current priorities (test harnesses, MDC-based components) are investments to make this process easier. The test harnesses help avoid the problem of people writing brittle unit tests that break whenever we change anything. The MDC-based components offloads a lot of the responsibility for updating pixels to Google's Material Design team.

I want to pursue new features more than anyone (hello cdk combobox and menu), but the work we're prioritizing instead is going to have a much bigger effect on our velocity in the long run.

@fosteman
Copy link

fosteman commented Jan 6, 2021

Inclusive Design methodologies span across devices as well as libraries, it's a hard work and this is what makes Google "inclusive" to it's users, making them feel heard and seen. Thanks for doing this @jelbourn, blogpost would be amazing!

@nzbin
Copy link

nzbin commented Jan 9, 2021

Why do we have this Popover for React but not for Angular ? https://material-ui.com/components/popover

I have built a material extensions library, you can try this one Popover.

@michaelfaith
Copy link

Why do we have this Popover for React but not for Angular ? https://material-ui.com/components/popover

I have built a material extensions library, you can try this one Popover.

That's actually pretty nice. Have you considered contributing it back to this project as a new component?

@Nek-
Copy link

Nek- commented Oct 7, 2021

Popovers are not part of the current material design spec, however they are a common component in desktop applications.

I'm surprised to see that and nobody to tell it's wrong. Maybe the spec has been updated so let me add some content here, because the popover actually exists in the spec. It's actually called rich tooltip. See it here: https://material.io/components/tooltips/web#rich-tooltips

Of course it also exists in MaterialUI 3 : https://m3.material.io/components/tooltips/overview

@Andrew-Marks-Trisept
Copy link

Andrew-Marks-Trisept commented Jun 6, 2022

The problem with most of the community solutions is accessibility. I must have tried close to 10 different solutions and even on the ones that weren't abandoned and still had working demos, most of them were completely inaccessible with a keyboard. The only one I found that works well is https://github.com/ncstate-sat/popover, so big thanks to @willshowell!

I don't think you can just use the CDK Overlay without some handling of focus in and out, tab trapping, etc.

Actually, I found it hard to even find this page, because there doesn't seem to be a standard name for these things (popup, popover, overlay, non-modal-dialog, dropdown, rich tooltip, etc.).

P.S. Google themselves make heavy use of this type of control here: https://www.google.com/travel/hotels

@alfaproject
Copy link

Angular material rich tooltips would be a great addition to this library, even if experimental under the MDC namespace

@haskelcurry
Copy link

Any updates on this?

@chances
Copy link

chances commented Jun 1, 2023

Why is this not a higher priority given the long history of this and many other related issues, not to mention the clear precedent set by Material 3's Rich Tooltips.

To my mind this seems more like a P2 issue, "The issue is important to a large percentage of users, with a workaround." The community demand is clear.

@michaelfaith
Copy link

michaelfaith commented Jun 1, 2023

I wonder if the new popover API might make it that much easier to build this (https://developer.chrome.com/blog/introducing-popover-api/) Though, I guess expansive browser support isn't quite there yet for it.

@andrewseguin andrewseguin changed the title Popover component [Tooltip] Add support for rich tooltips Dec 7, 2023
@andrewseguin andrewseguin changed the title [Tooltip] Add support for rich tooltips feat(tooltip): add support for rich tooltips Dec 11, 2023
@aastrouski
Copy link

Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: new Issues requesting a new component or area feature This issue represents a new feature or feature request rather than a bug or bug fix intern project! This issue is part of an intern project! https://careers.google.com/students/ P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests