gpt4 book ai didi

reactjs - 对话框内的 Popper 内的 Material-UI TextField 不起作用

转载 作者:行者123 更新时间:2023-12-04 11:20:46 24 4
gpt4 key购买 nike

如果 TextField 等 Material-UI 输入元素位于对话框内的 Popper 内,则它们无法工作/无法获得焦点。

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

Popper 元素的 zIndex 值是在 Dialog 元素前面显示 Popper 所必需的。

简单代码和框示例: https://codesandbox.io/s/input-inside-popper-inside-dialog-not-working-9y7rg

最佳答案

您可以使用 disableEnforceFocus属性(property)在 Dialog (继承自 Modal )来解决这个问题。

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

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

相关答案: CKEditor 4 having problem when used in Material UI dialog

关于reactjs - 对话框内的 Popper 内的 Material-UI TextField 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60621278/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com