-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
base: master
Are you sure you want to change the base?
feat(module:menu): add click trigger for submenus #8461
Conversation
…vanehPA/ng-zorro-antd into feature/submenu-triggers
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
@@ -96,12 +97,13 @@ export class NzSubMenuTitleComponent implements OnDestroy, OnInit { | |||
} | |||
|
|||
setMouseState(state: boolean): void { | |||
if (!this.nzDisabled) { | |||
if ((!this.nzDisabled && this.nzTriggerSubMenuAction === 'hover') || !state) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It'll be great if support closing submenu when clicking outside of the submenu-title
- 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partially approved
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
In Ant design, it is possible to choose between a
click
or ahover
trigger for submenues.Issue Number: #4745
What is the new behavior?
click
trigger implemented.Does this PR introduce a breaking change?
Other information