Skip to content
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

Cascader组件在设置expandTrigger为hover时,如果悬停到没有下级菜单的一个一级菜单上,不会隐藏之前显示的其它一级菜单的二级菜单 #41134

Closed
wangzhengbo opened this issue Mar 9, 2023 · 13 comments
Labels
🐛 Bug Ant Design Team had proved that this is a bug.

Comments

@wangzhengbo
Copy link

wangzhengbo commented Mar 9, 2023

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. 鼠标hover到Zhejiang上,会显示Hangzhou二级菜单;
  2. 鼠标hover到beijing上,由于beijing没有children,且设置了isLeaf为true,所以没有二级菜单,但是没有隐藏Hangzhou二级菜单;
  3. expandTrigger属性设置为click(默认值)时,没有上述问题

What is expected?

在设置expandTrigger为hover时,如果悬停到没有下级菜单的一个一级菜单上,会隐藏之前显示的其它一级菜单的二级菜单

What is actually happening?

在设置expandTrigger为hover时,如果悬停到没有下级菜单的一个一级菜单上,不会隐藏之前显示的其它一级菜单的二级菜单

Environment Info
antd 5.3.0
React 18.0.0
System Mac
Browser Chrome 111

具体应该是https://github.com/react-component/cascader/blob/e7b6d156f6f3e303d4f7e1a81575a9abbb3be382/src/OptionList/Column.tsx中的

const triggerOpenPath = () => {
            if (!disabled && (!hoverOpen || !isMergedLeaf)) {
              onActive(fullPath);
            }
};

方法中,对于leaf节点,限制了!hoverOpen时才生效。

@Wxh16144 Wxh16144 added 🐛 Bug Ant Design Team had proved that this is a bug. and removed unconfirmed labels Mar 9, 2023
@Wxh16144
Copy link
Member

Wxh16144 commented Mar 9, 2023

让我来看看该应该怎么修复

@Wxh16144
Copy link
Member

已经在 5.3.1 中修复~

@wangzhengbo
Copy link
Author

已经在 5.3.1 中修复~

多谢。麻烦问下修复会合并到4.x版本中吗?

@Wxh16144
Copy link
Member

Wxh16144 commented Mar 14, 2023

会合并到4.x版本中

瞟了一眼,4.x 依赖的 rc-cascader 版本差了 2 个 minor,我需要检查一下能否升级。

更新:4.x 版本在 antd >= 4.23.2 包含修复

@wangzhengbo
Copy link
Author

会合并到4.x版本中

瞟了一眼,4.x 依赖的 rc-cascader 版本差了 2 个 minor,我需要检查一下能否升级。

更新:4.x 版本在 antd >= 4.23.2 包含修复

多谢,辛苦了。

@kashtian
Copy link

会合并到4.x版本中

瞟了一眼,4.x 依赖的 rc-cascader 版本差了 2 个 minor,我需要检查一下能否升级。

更新:4.x 版本在 antd >= 4.23.2 包含修复

目前看,antd4.x 仍未修复该问题 @Wxh16144

@Wxh16144
Copy link
Member

Wxh16144 commented Apr 24, 2023

目前看,antd4.x 仍未修复该问题

@kashtian 需要重新安装 antd, 注意检查 lock 文件. 如果还存在问题可以帮助我们提供一个复现仓库, 感谢~

@afc163
Copy link
Member

afc163 commented Apr 24, 2023

@kashtian 清了 lock 文件重新安装即可。需要底层依赖更新到 rc-cascader@3.7.2 。

@kashtian
Copy link

目前看,antd4.x 仍未修复该问题

@kashtian 需要重新安装 antd, 注意检查 lock 文件. 如果还存在问题可以帮助我们提供一个复现仓库, 感谢~

感谢,已发现问题,引用的 antd cdn 包,rc-cascader 不是 3.7.2 的版本

@kashtian
Copy link

@kashtian 清了 lock 文件重新安装即可。需要底层依赖更新到 rc-cascader@3.7.2 。

感谢,已发现问题,确实是 rc-cascader 版本不对

@kashtian
Copy link

@Wxh16144 我发现 antd 官方提供的 cdn 包也有问题,https://cdnjs.cloudflare.com/ajax/libs/antd/4.24.8/antd-with-locales.js

@afc163
Copy link
Member

afc163 commented Apr 25, 2023

@kashtian 试试 4.24.9

@kashtian
Copy link

@kashtian 试试 4.24.9

4.24.9 可以的,多谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Ant Design Team had proved that this is a bug.
Projects
None yet
4 participants