Skip to content

[Popover] [Dialog] Body's padding gets removed when open in modal mode #1548

@xavier-kairn

Description

@xavier-kairn

Bug report

Current Behavior

When the body has some top padding, opening a Popover or a Dialog makes the body jump up.

This is also the case with left-padding.

Popover closed:
image

Popover opened:
image

Expected behavior

That the body stays in place 😊

Reproducible example

https://codesandbox.io/s/vigilant-bird-1fj6og?file=/src/App.tsx

Suggested solution

From my exploration, the problem comes from react-remove-scroll-bar, that is used by react-remove-scroll to remove the scrollbars in modal mode. I was not sure exactly where/how to post this issue so I came here. In my case, being able to pass removeScrollBar={false} to RemoveScroll here solves my issue. (equivalent line adding RemoveScroll in 0.1.6 actually)

Therefore I guess allowing to pass parameters to RemoveScroll would solve my issue.

Additional context

Your environment

Software Name(s) Version
Radix Package(s) Popover, Dialog 0.1.6, 0.1.7
React n/a 17.0.2
Browser Brave, Safari Chrome
Assistive tech
Node n/a v16.12.0
npm/yarn yarn v1.22.17
Operating System

I think the problem is also there in 1.0.0 looking at the code but I haven't checked.

Cheers 🎉

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions