Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material-UI TextField inside Popper inside Dialog not working

Material-UI input elements like TextField are not working / can not get the focus if they are inside a Popper inside a Dialog.

<Dialog open={true}>
  ...
  <Popper open={true} style={{zIndex: 1500}}>
    ...
    <TextField />
    ...
  </Popper>
  ...  
</Dialog>

The zIndex value for the Popper element is necessary to display Popper in front of the Dialog element.

Simple codesandbox example: https://codesandbox.io/s/input-inside-popper-inside-dialog-not-working-9y7rg

like image 891
markusf1 Avatar asked Mar 10 '20 15:03

markusf1


1 Answers

You can use the disableEnforceFocus property on Dialog (inherited from Modal) to fix this.

<Dialog open={true} disableEnforceFocus>
    <SimplePopper />
</Dialog>

Edit input-inside-Popper-inside-Dialog-not-working

Related answer: CKEditor 4 having problem when used in Material UI dialog

like image 79
Ryan Cogswell Avatar answered Oct 24 '22 07:10

Ryan Cogswell