Material-UI TextField inside Popper inside Dialog not working

markusf1 :

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

Ryan Cogswell :

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=174134&siteId=1