Skip to content

[Autocomplete] dropdown appears in the background opened inside a Dialog #22014

@aquibbaig

Description

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

The dropdown is not shown on clicking the "Add Labels" button.

Expected Behavior 🤔

The popper should be opened and we would be able to see the content inside it i.e. the "Autocomplete" component.

Steps to Reproduce 🕹

I have added a sandbox for the above mentioned steps. Kindly have a look into it.
https://codesandbox.io/s/blissful-dewdney-utnpv

Context 🔦

I have a use case where I need to open up the autocomplete API on top of a Dialog component, however the dropdown never seems to appear. I debugged the following issue and I found that when I click on the "add labels" option it sets the "anchorEl" as it should do, thanks to the "handleClick" function, but immediately after that the "onClose" prop of "Autocomplete" component gets fired which sets the "anchorEl" back to null. Therefore the dropdown never seems to appear. Again on digging deeper, I logged the "reason" variable provided to "handleClose" which shows an event "blur" when I click on the element to display the dropdown.

Your Environment 🌎

Tech Version
Material-UI v4.9.7
React 16.13.1
Browser Firefox
TypeScript 3.6.4
etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to the documentation.good first issueGreat for first contributions. Enable to learn the contribution process.scope: autocompleteChanges related to the autocomplete. This includes ComboBox.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions