question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tooltip: buggy when deployed as an Angular Element

See original GitHub issue

What is the expected behavior?

That tooltips are not buggy.

What is the current behavior?

Tooltips are buggy.

What are the steps to reproduce?

app.module.ts import { MatTooltipModule } from '@angular/material/tooltip';

somecomponent.component.html <button mat-button class="button" (click)="openDialog()" matTooltip="Åpne" aria-label="Åpne"> ÅPNE</button>

And then deploy the whole project as an Angular Element.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular CLI: 7.3.6 Node: 10.15.2 OS: win32 x64 Angular: 7.2.10 @angular/material 7.3.5 typescript 3.1.1 Chrome Version 73.0.3683.86 (Official Build) (64-bit)

Is there anything else we should know?

Every time i hover on the button, a small grey “blob” is added to a “row” under the address-field in my browser.

Screenshot_188

When i click the button, a “tick()” is triggered (because angular elements needs that without ngZone) and the row of grey blobs is replaced with the tooltip. It’s in the wrong spot, but it’s there. I suspect this has something to do with how “Angular Elements” work? Since the grey blobs were only “converted” to the tooltip after a “tick()”?

Screenshot_189

@levgaas posted the same issue a year ago, but did not specify how he managed to fix it: https://github.com/angular/material2/issues/11361

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
xigollecommented, Feb 11, 2020

Is there any progress/solution for this problem. We are also experiencing the same isue with the tooltips.

4reactions
turbolegocommented, May 14, 2019

Just in case anyone else has problems with this, we ended up “hiding” the original tooltips in the paginator and adding our own using “pure css”. It’s not pretty, but it works while this gets sorted out.

in styles.scss (to hide the existing tooltip):

mat-tooltip-component > .mat-tooltip { display: none; }

Added the following code to the .scss file of the component where we have the paginator: (Stole some code from this guide by @yjose: https://medium.freecodecamp.org/a-step-by-step-guide-to-making-pure-css-tooltips-3d5a3e237346)


:root {
  --paginator-next-button: "Next Page";
  --paginator-previous-button: "Previous Page";
}

.mat-paginator-navigation-next::after {
  content: var(--paginator-next-button);
}
.mat-paginator-navigation-previous::after {
  content: var(--paginator-previous-button);
}

.mat-paginator-navigation-next:hover::after,
.mat-paginator-navigation-next:hover::before,
.mat-paginator-navigation-previous:hover::after,
.mat-paginator-navigation-previous:hover::before {
  opacity:1;
  transition:opacity  0s linear 1s;
}

.mat-paginator-navigation-next,.mat-paginator-navigation-previous {
  position:relative;
  display:inline-block;
}

.mat-paginator-navigation-next::before,.mat-paginator-navigation-previous::before{
  position: absolute;
  bottom: -35px;
  left: 50%;
  padding: 8px;
  transform: translateX(-50%) scale(0);
  transition: transform 0.3s ease-in-out;
  transform-origin: top;
  background: #616161e6;
  color: white;
  border-radius: 2px;
  font-size: 12px;
  font-family: Roboto,sans-serif;
  font-weight: 400;

}

.mat-paginator-navigation-next::after,.mat-paginator-navigation-previous::after{
  position: absolute;
  left:50%;
  top:-6px;
  transform: translateX(-50%)   translateY(-100%);
  background: #616161e6;
  color: white;
  text-align: center;
  line-height: 1.5;
  padding:4px 2px;
  font-size: 12px;
  min-width: 80px;
  border-radius: 5px;
  pointer-events: none;
  padding: 4px 4px;
  z-index:99;
  opacity:0;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why don't work angular material tooltip, when add to element ...
I'm writing code to add angular material tooltip with ts code to angular 7. In template its added. But tooltip don't work.
Read more >
Tooltips in the time of WCAG 2.1 | Sarah Higley
The first step is to ensure that the visual display can be controlled by either a keyboard or a mouse. To do this,...
Read more >
Tooltip Angular UI Component - Nebular - GitHub Pages
Hint provides capability to show the component when the user hovers over the host element and hide when the user hovers out of...
Read more >
Building a tooltip component - web.dev
A tooltip is a non-modal, non-blocking, non-interactive overlay containing supplemental information to user interfaces. It is hidden by default ...
Read more >
Custom Tooltip Component using Angular's Style Directive ...
Custom Tooltip Component using Angular's Style Directive and Coordinates from Web APIs MouseEvent · Create App and Add Dependencies · Create a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found