Skip to content

[ClickAwayListener] Handle portaled element #18586

Closed
@ccmartell

Description

@ccmartell
  • 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 😯

When a select component is within a popper element and disablePortal is true, the dropdown items are positioned absolutely in relation to the popper element and not the page. This is also true for any absolutely positioned container that uses transform (which is what popper is using).

Expected Behavior 🤔

Expected behavior would be that the position of the dropdown would match the location of the select element and display correctly.

Steps to Reproduce 🕹

I have mocked the issue here

Steps:

  1. Place absolutely positioned component and add a transform (or just use popper)
  2. Add select component

Context 🔦

When using a clickaway listener with popper to display a popup, a portaled menu will cause the clickaway listener to fire, closing the popper and losing our work. We then were able to use disablePortal in the MenuProps, but that causes this issue. We have done a workaround using Popover as it doesn't have a transform and displays the Select menu correctly.

Your Environment 🌎

Tech Version
Material-UI v4.7.0
React v16.11.0
Browser Chrome
TypeScript No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something doesn't workcomponent: ClickAwayListenerThe React componentgood first issueGreat for first contributions. Enable to learn the contribution process.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions