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.

[DOM] `hide` middleware `referenceHidden` incorrect when reference ancestor is `position: absolute`

See original GitHub issue

For the following HTML structure, hide middleware return true, indicate that reference element been hided. Event though its parent is overflow:hidden and computed style height: 0, actually position: absolute make it related with outer relatived ancestor.

    <div style="position: relative;">
      <div style="overflow: hidden; border: 4px solid green;">
        <div style="position: absolute;">
          <div id="reference"></div>
        </div>
        <div id="floating">Floating element</div>
      </div>
    </div>

sandbox: https://codesandbox.io/s/mutable-browser-euniq7?file=/src/index.js:318-369

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
atomikscommented, Nov 3, 2022

Rip, did feel like there would be more complex cases to handle than the few tests I wrote. 😞

1reaction
atomikscommented, Aug 26, 2022

In the Sandbox I see it’s been edited so that the reference element has position: absolute instead of the ancestor which fixes the issue.

Probably need to check every ancestor between the reference element and its clipping ancestor and see if any of them absolute?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using position:absolute, the nearest positioned ancestor is ...
Two general rules to keep in mind: An absolutely positioned element will be positioned within its containing block, which is defined by the ......
Read more >
computePosition
This is an async function that computes and returns x and y coordinates to position a floating element next to a reference element....
Read more >
How to make absolute positioned elements overlap their ...
Anyway, here our main problem is that the relative parent is also the overflow:hidden one. Well, if we simply move the position rule...
Read more >
UDN Search
the grid inspector allows you to examine css grid layouts using the firefox devtools, discovering grids present on a page, examining and modifying...
Read more >
position - CSS: Cascading Style Sheets - MDN Web Docs
Note that a sticky element "sticks" to its nearest ancestor that has a "scrolling mechanism" (created when overflow is hidden , scroll ...
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