Skip to content

feat(module:cascader): control the visibility of menu by nzOpen - #9448

Merged
Laffery merged 2 commits into
NG-ZORRO:masterfrom
WwwHhhYran:feat/control_cascader_by_nzOpen
Oct 11, 2025
Merged

Laffery merged 2 commits into
NG-ZORRO:masterfrom
WwwHhhYran:feat/control_cascader_by_nzOpen

Conversation

@WwwHhhYran

Copy link
Copy Markdown
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the new behavior?

If nzOpen is not undefined, the visibility of the menu is completely controlled by nzOpen, which is consistent with Ant Design.

Does this PR introduce a breaking change?

  • Yes
  • No

@codecov

codecov Bot commented Sep 30, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.40%. Comparing base (cef5fdb) to head (fa381e7).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9448      +/-   ##
==========================================
+ Coverage   91.29%   91.40%   +0.11%     
==========================================
  Files         561      563       +2     
  Lines       19753    19824      +71     
  Branches     3163     3176      +13     
==========================================
+ Hits        18034    18121      +87     
+ Misses       1371     1358      -13     
+ Partials      348      345       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@WwwHhhYran
WwwHhhYran force-pushed the feat/control_cascader_by_nzOpen branch from 251acd8 to 8e14e4f Compare September 30, 2025 09:42
@WwwHhhYran

Copy link
Copy Markdown
Member Author

In addition to nzOpen, I also added the Backspace keyboard event in this PR, consistent with Ant Desgin

}

private moveLeft(): void {
private prevColumn(): void {

@Laffery Laffery Oct 3, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我观察了下 antd 的交互,当前仅一列时 prevColumn 会关闭弹出面板,也许我们可以在这里补充上:)

BTW,我发现还有一些键盘交互我们还没有支持或者支持得不够好,分别举例:

  • 不支持多选模式下通过回车键选中/取消选中选项
  • focus 输入框后,可以使用方向键唤起弹出面板。其中方向键为 DOWN 或 RIGHT 时,没有默认选中第一列第一行(事实上 antd 的行为等价于 open + down/right,而 zorro 只做了 open)

我们可以在单独的 PR 里优化这些键盘交互问题

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已补充。此外,还发现一个问题:如果已经存在某个值了zhejiang,hangzhou,xihu,点开 cascader 的时候会自动高亮所有列,如果我向左依次点到 zhejiang,那么 hangzhou 的高亮会消失,xihu 所在列会折叠起来。此时,点击外部区域让菜单收起,这个行为应该是没有选择结果,值应该还是 zhejiang, hangzhou, xihu,再次点开 cascader,则不会高亮所有列,这和 antd 不一致,

复线 👇

2025-10-10.18.07.23.mov

@Laffery Laffery Oct 11, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,可以单独 PR 修下不一致的交互行为

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

focus 输入框后,可以使用方向键唤起弹出面板。其中方向键为 DOWN 或 RIGHT 时,没有默认选中第一列第一行(事实上 antd 的行为等价于 open + down/right,而 zorro 只做了 open)

@Laffery 这个没复现出来,zorro 和 antd 的行为是一致的吧?

@Laffery Laffery left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Laffery
Laffery merged commit 4d5ec65 into NG-ZORRO:master Oct 11, 2025
1 check failed
@Laffery Laffery added this to the v20.4 milestone Oct 11, 2025
@WwwHhhYran
WwwHhhYran deleted the feat/control_cascader_by_nzOpen branch October 11, 2025 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants