-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SubMenu 水平模式 在IE 浏览器下面 不弹出二级菜单 #444
Comments
same problem here. |
@yiminghe 大神帮忙看哈这个兼容性问题撒 |
有啥报错么? |
@afc163 |
来个 PR 吧 |
原因可能跟rc-overflow相关,在ie11下,rc-overflow的base案例,渲染和chromium内核/firefox不一致。 |
表面原因是:overflow非第0项,display被设置为false,https://github.com/react-component/overflow/blob/v1.2.5/src/Overflow.tsx#L316 ,rest项的高度被设置为了0
目前绕过的方法是将上述流程打断。 React.useEffect(
() => () => {
internalRegisterSize(null);
},
[],
); 改成 React.useEffect(
() => {
internalRegisterSize(1);
},
[],
) 又或者将prevRestWidth初始值改为1 深层的原因应该是跟ResizeObserver相关,正确的修复应该是保证ResizeObserver在ie11上的行为。 |
+1 |
根据spec,目前确定为是polyfill的bug
将rc-resize-observer的bug验证代码微微修改一下, <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ResizeObserver IE11 bug</title>
<style>
.hidden {
height: 0;
overflow: hidden;
}
</style>
<script src="dist/ResizeObserver.global.js"></script>
</head>
<body>
<div id="parent">
<div class="hidden">label 1</div>
<div class="hidden">label 2</div>
<div class="hidden">label 3</div>
</div>
<script>
function pResize() {
console.log('resize in Parent');
}
function cResize(entries) {
var i;
for (i = 0; i < entries.length; i++) {
console.log('resize in Child', entries[i].target.innerText);
}
}
var p = document.querySelector('#parent');
var children = document.querySelectorAll('.hidden');
var obp = new ResizeObserver(pResize);
var obc = new ResizeObserver(cResize);
obp.observe(p);
var i, el;
for (i = 0; i < children.length; i++) {
el = children[i];
obc.observe(el);
}
</script>
</body>
</html> 继续往下挖,resize-observer-polyfill的实现,在IE11上使用的是mutation observer, |
emmm……现在挖出来是, |
已给上游提交quick fix 等待合并,或者正式的修复…… |
等上游估计是遥遥无期了,用webpack.NormalModuleReplacementPlugin先凑合本地解决了。 |
可以给个示例吗?感谢 |
@SmileLifeIven new webpack.NormalModuleReplacementPlugin(
/^resize-observer-polyfill$/,
resolvePath('tools', 'lib', 'resize-observer-polyfill'),
), 其中 |
感谢 |
SubMenu 水平模式 在IE 浏览器下面 不弹出二级菜单,只有第一个菜单有二级菜单能够正确弹出,后面其他菜单有二级菜单的情况都不会弹出, 我多次测试后发现在8.x 版本水平模式在IE 都能正确的弹出二级菜单,一旦升级到9.x 版本就不能正确兼容IE。
The text was updated successfully, but these errors were encountered: