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.

Using tabs inside a popover incorrectly calculates the left offset based on bounting box calculations

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Opening a popover that contains tabs incorrectly determines the ‘start’ position of the indicator, which appears offset from the page, not the containing popover

Expected Behavior 🤔

The start position of the indicator should be calculated from the containing element.

It looks like this issue https://github.com/mui-org/material-ui/issues/9337 but it is not, because when we implement the useEffect solution it still does not correctly calculate the offset.

Looking at the internal material code something is going wrong in calculating tabMeta.left - tabsMeta.left on load because the laculation ends up being 16 - 173 (in our example), but if I change tab and then change back it correctly works out that it’s 16 - 16. It’s as though the tabsMeta calculates it’s boundingClientRect too soon.

Steps to Reproduce 🕹

Edit Material demo

Steps:

  1. Create a component using popover
  2. Put tabs inside
  3. Notice the indicator is offset incorrectly
  4. cry

Attempts to fix

Edit Material demo

Tries to use a setTimeout in a useEffect.

Context 🔦

Tabs in a popover

Your Environment 🌎

Tech Version
Material-UI ^4.5.3
React ^16.10.2
Browser Chrome

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
AncientSwordRagecommented, Jun 12, 2020

I call updateIndicator() in an onEntered callback.

5reactions
oliviertassinaricommented, Feb 20, 2020

@AncientSwordRage We appreciate the time spend in the issue description and reproduction, but I’m closing as a duplicate #9337.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using tabs inside a popover incorrectly calculates the left ...
It looks like this issue #9337 but it is not, because when we implement the useEffect solution it still does not correctly calculate...
Read more >
Getting the horizontal and vertical centers of an element
I often find myself needing to calculate the horizontal center and vertical center of an element. One example is a popover.
Read more >
Changing the position of Bootstrap popovers based on ...
I want the Twitter Bootstap Popover position to be RIGHT unless the hotspot popover will be positioned beyond the viewport, then I want...
Read more >
Safari Technology Preview Release Notes
Safari Extensions. Fixed an issue where browser. tabs sometimes returned an incorrect URL for pinned tabs.
Read more >
JavaScript
Sometimes it is necessary to use Bootstrap plugins with other UI frameworks. In these circumstances, namespace collisions can occasionally occur.
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