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.

[Dialog][Popover] Scrolling issue when Popover inside Dialog

See original GitHub issue

Documentation

Relevant Radix Component(s)

Here in the docs it say to make Overlay a sibling to Content.

CleanShot 2022-02-15 at 11 02 22

This setup doesn’t work if you have a scrollable popover in the dialog content. On this line a ref is passed to RemoveScroll but I think that by using just a ref that RemoveScroll doesn’t consider the portalled element a part of the react tree.

In my own code I fixed this by putting my Content inside of my Overlay. After this change my scrollable popover could scroll again since RemoveScroll now has access to the react tree.

CleanShot 2022-02-15 at 11 07 04

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
jjenzzcommented, Feb 15, 2022

Hmm, yep looks like it could be a RemoveScroll shards thing 🙈 we need a ticket to create our own react-tree-aware remove scroll at some stage.

2reactions
hipstersmoothiecommented, Feb 15, 2022

Here you can see if you follow all of the docs for both popover and dialog you can’t scroll a popover in a dialog. I had to read through radix’s source code and dependencies to figure out that I needed to wrap my content in the overlay. While both are valid I think the docs should steer people towards code+structure that will work out of the box without having to understand how the internals are actually working.

https://codesandbox.io/s/twilight-http-veu4gw?file=/App.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Material UI - Unblock scrolling when popover is opened
When i open the popover, the scroll-bar of the web page suddenly disappeared and it's not the part of user experience in my...
Read more >
JavaScript
For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning you must initialize them yourself. One way to initialize all tooltips on...
Read more >
Popover
Popover is a non-modal dialog that floats around a trigger. ... Popover is built on top of the Popper.js library. Import#. Popover :...
Read more >
Josh W. Comeau
... of low-level primitives, things like <ScrollArea> or <Dialog> or <Popover>. ... fixes some of the cross-browser inconsistencies with scroll containers.
Read more >
Dialogs, modality and popovers seem similar. How are they ...
Note: at the time of writing, popover is still a proposal and only available as an experiment, behind a flag, and in Chromium....
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