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] Tooltip should automatically determine position

See original GitHub issue

Bug, feature request, or proposal:

Feature request : tooltip auto positionning

What is the expected behavior?

mdTooltip linked to <md-icon-button> with no tooltipPosition defined should position automatically based on the given space, or at least automatically setup its tooltipPosition

What is the current behavior?

Default tooltip shows up below the element and overflows the screen

What are the steps to reproduce?

Add a tooltip to a <md-icon-button> on the edge of your screen

Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: https://goo.gl/DlHd6U Plunker

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

Avoid developpers handling themselves the edge case with approximate ElementRef manipulation.

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

@angular/material”: “^2.0.0-beta.2”

Is there anything else we should know?

I found my way getting around this issue, by manipulating ElementRef after the view is initialized :

ngAfterViewInit() {
    if(this.elRef.nativeElement.offsetLeft === 0){
      this.tooltipPosition = "right";
    }
  }

workaround Plunker

I’m not used to angular2 dom manipulations, any better option would be highly appreciated

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jnameskycommented, Mar 13, 2017

Auto positioning so the tooltip will display on screen is a feature I know our team will be needing at some point in the near future.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 7, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Tooltip] Tooltip should automatically determine position #3569
Auto positioning so the tooltip will display on screen is a feature I know our team will be needing at some point in...
Read more >
Position in React Tooltip component - Syncfusion
The Tooltip and its tip pointer can be positioned dynamically based on the target's location. This can be achieved by using the refresh...
Read more >
Auto placement bootstrap tooltip - Oodles Technologies
At first, How placement works, we need to understand it. When auto is specified with the top | bottom | left | right,...
Read more >
Tooltips - Bootstrap
When auto is specified, it will dynamically reorient the tooltip. When a function is used to determine the placement, it is called with...
Read more >
Angular 2 tooltip should auto adjust position itself in mobile or ...
Try this: Tooltip location from left = hostElPos.left. Tooltip location from right = current window width - hostElPos.left - hostElPos.width ...
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