有人遇到过 Material UI 下拉菜单选择和模态将内容向左移动的问题吗?我试图给它位置:绝对我也尝试给菜单项位置:绝对,但内容仍然发生了变化。
您可以在这里找到相关信息:https://github.com/mui-org/material-ui/issues/10000
那里还引用了许多相关问题。根据模式下主窗口元素的定位方式,有不同的修复方法。
在我的 React 应用程序中,这对我有用。
<body style="overflow-y: scroll;">
//index.html
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body style="overflow-y: scroll;">
<noscript>
</noscript>
<div id="root"></div>
<script></script>
</body>
</html>
是的,我遇到了这个问题。对我来说,添加
overflow-y: scroll
只是让右侧的额外空间始终存在(如果存在 select 元素)。我在 Devtools 中进行了调查。由于某种原因,单击选择会将 padding-right: 15px
添加到正文中。我添加了以下内容并修复了它。
body {
padding-right: 0 !important;
}
必须对标题做同样的事情。
这也为我解决了问题
body {
padding-right: 0 !important;
}