[英]Material UI TextField label appears over the popper
I am using Material-UI and I have a form with TextFields.我正在使用 Material-UI 并且我有一个带有 TextFields 的表单。
When I activate my popper, the labels from the form textfields overlay the popper, but not the field itself.当我激活 popper 时,表单文本字段中的标签会覆盖 popper,但不会覆盖字段本身。 Why does it overlay, and how can I remove the overlay so that the popper is on top?
为什么它会叠加,我怎样才能移除叠加层以使 popper 位于顶部?
Here is the relevant code:以下是相关代码:
<Popper id="userList" open={searchOptionsOpen} anchorEl={anchorEl} transition>
{({ TransitionProps }) => (
<Fade {...TransitionProps} timeout={350}>
<ClickAwayListener onClickAway={handleClose}>
<Paper fullWidth>
<Grid container>
<Grid item xs={12}>
<List className={styles.popperList}>
<ListItem>
<ListItemText className={styles.popperAddNewUser} primary="Add new user" />
</ListItem>
{fetchedUsers.map((user, index) => (
<ListItem key={index}>
<ListItemText>{user.displayName}</ListItemText>
</ListItem>
))}
</List>
</Grid>
</Grid>
</Paper>
</ClickAwayListener>
</Fade>
)}
</Popper>
</Grid>
<Grid item xs={12} className={styles.header}>
<Typography variant="h2">{t('users.add.userDetails')}</Typography>
</Grid>
<Grid item xs={6}>
<TextField
fullWidth
required
aria-labelledby="first-name-text"
id="firstName"
value={userDetails.firstName}
onChange={handleTextChange('userDetails')}
variant="outlined"
label={t('users.add.input.firstName')}
margin="dense"
className={styles.leftTextField}
/>
</Grid>
Try setting the Z-Index on the Popper itself to something higher and that will solve the issue.尝试将 Popper 本身的 Z-Index 设置为更高的值,这将解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.