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

feat(module:menu): add click trigger for submenus #8461

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

ParsaArvanehPA
Copy link
Contributor

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 current behavior?

In Ant design, it is possible to choose between a click or a hover trigger for submenues.

Issue Number: #4745

What is the new behavior?

click trigger implemented.

Does this PR introduce a breaking change?

[ ] Yes
[✔] No

Other information

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.62%. Comparing base (2576612) to head (f427c09).
Report is 91 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8461      +/-   ##
==========================================
+ Coverage   91.60%   91.62%   +0.02%     
==========================================
  Files         519      530      +11     
  Lines       18074    18394     +320     
  Branches     2848     2813      -35     
==========================================
+ Hits        16557    16854     +297     
- Misses       1218     1224       +6     
- Partials      299      316      +17     

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

@@ -96,12 +97,13 @@ export class NzSubMenuTitleComponent implements OnDestroy, OnInit {
}

setMouseState(state: boolean): void {
if (!this.nzDisabled) {
if ((!this.nzDisabled && this.nzTriggerSubMenuAction === 'hover') || !state) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

|| !state -> mouseLeave event will trigger closing the submenu

this.subMenuMouseState.next(state);
}
}
clickTitle(): void {
if (this.mode === 'inline' && !this.nzDisabled) {
if ((this.mode === 'inline' || this.nzTriggerSubMenuAction === 'click') && !this.nzDisabled) {
this.subMenuMouseState.next(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. It'll be great if support closing submenu when clicking outside of the submenu-title
  2. Please check that sub-sub-menu will be closed recursively if closing the higher-level submeu. For example, submenu of Option3 should be closed when closing submenu of Option2
- Option 1
- Option 2
   - Option 3
      - Option 4

Copy link
Collaborator

@Laffery Laffery left a comment

Choose a reason for hiding this comment

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

partially approved

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.

None yet

3 participants