Skip to content

DropdownMenu changes padding / margin on document body. #346

@steveruizok

Description

@steveruizok

Bug report

Current Behavior

When active, the DropdownMenu component adds the following CSS to the document body.

  body {
    overflow: hidden !important;
    position: relative !important;
    padding-left: 8px;
    padding-top: 8px;
    padding-right: 8px;
    margin-left:0;
    margin-top:0;
    margin-right: 0px !important;
  }

This can cause layout shift on layouts that have set padding / margin on the body.

Expected behavior

Opening the dropdown should not cause the layout to shift.

Reproducible example

Codesandbox.

Suggested solution

I'm guessing that the margins / padding have a function, though it isn't clear to me what that is. As long as that part of the CSS may be removed without breaking the component, I would suggest removing the padding / margins.

Your environment

Software Name(s) Version
Radix Package(s) Dropdown 0.0.1
React n/a 17.0.0
Browser Chrome
Assistive tech n/a
Node n/a
npm/yarn
Operating System Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions