Ant-design-mobile: modal弹出后滑动,遮罩层下面的内容也会滚动(滚动穿透问题)

Created on 7 Mar 2018  ·  9Comments  ·  Source: ant-design/ant-design-mobile

Version

2.1.6

Environment

系统版本:windows7 64位; 浏览器:chrome 64.0;

Reproduction link

https://mobile.ant.design/components/modal-cn/

Steps to reproduce

在移动端使用antd-mobilemodal组件的时候发现一个重要的问题,打开modal层之后,滑动modal的内容,当超出滑动范围后遮罩层下面的内容也会滚动

What is expected?

一般modal在打开之后要让遮罩层之下的内容禁止滚动,希望react-mobile团队能够解决这个问题。

What is actually happening?

一般modal在打开之后要让遮罩层之下的内容禁止滚动,希望react-mobile团队能够解决这个问题。

All 9 comments

It will be better to write your issue/comment in English, so more people can understand you.
And this means that more people can help you or benefit from your issue/comment.
See: https://github.com/ant-design/ant-design/issues/4897

在移动端(如微信),当modal打开之后给body增加overflow: hidden;并不能阻止滚动穿透的问题。
我目前的解决办法是,在modal打开之后给body增加display: fixed; width: 100%;样式,关闭modal则去掉该样式。

在手机上看 demo 效果

@warmhug 我的需求相反,modal弹出后,能不能仍然操作底下的组件?

@koupeng 不能操作, Modal 是模态框,不是 message 这种

@94younglau fixed会引发页面闪烁

@warmhug modal模块下都存在以下问题:
1、浮层都会滚动穿透,
2、浮层会抖动(ios)
3、浮层层级不对

解决滚动穿透问题可参考我的方案:https://github.com/linweiwei123/popup

这问题没有解决 为啥关闭?

It will be better to write your issue/comment in English, so more people can understand you.
And this means that more people can help you or benefit from your issue/comment.
See: ant-design/ant-design#4897

为毛应付性的回答这个问题,这个很明显,完全不需要搞一大堆东西来还原

Was this page helpful?
0 / 5 - 0 ratings