-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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:cdkconnectedoverlay): supports disabling click on mask #8878
base: master
Are you sure you want to change the base?
Conversation
This preview will be available after the AzureCI is passed. |
d55ccf5
to
372756c
Compare
372756c
to
90214cb
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8878 +/- ##
==========================================
- Coverage 91.88% 91.84% -0.04%
==========================================
Files 537 537
Lines 18453 18473 +20
Branches 2814 2816 +2
==========================================
+ Hits 16955 16966 +11
- Misses 1196 1205 +9
Partials 302 302 ☔ View full report in Codecov by Sentry. |
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.
1 comments, and please add unit tests
@@ -425,6 +432,10 @@ export abstract class NzTooltipBaseComponent implements OnDestroy, OnInit { | |||
} | |||
|
|||
hide(): void { | |||
if (!this.nzOverlayClickable) { |
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.
There are two ways that invoke hide()
method:
Take nz-popconfirm for an example,
- click outside overlay
- overlay detachments
<ng-template
#overlay="cdkConnectedOverlay"
cdkConnectedOverlay
nzConnectedOverlay
[cdkConnectedOverlayHasBackdrop]="nzBackdrop"
[cdkConnectedOverlayOrigin]="origin"
(overlayOutsideClick)="onClickOutside($event)"
(detach)="hide()"
(positionChange)="onPositionChange($event)"
[cdkConnectedOverlayPositions]="_positions"
[cdkConnectedOverlayOpen]="_visible"
[cdkConnectedOverlayPush]="cdkConnectedOverlayPush"
[nzArrowPointAtCenter]="nzArrowPointAtCenter"
>
...
</ng-template>
If skip hiding the popconfirm here, the overlay detachments will not hide the popconfirm correctly.
So what about adding this condition at the onClickOutside
method?
onClickOutside(event: MouseEvent): void {
+ if (!this.nzOverlayClickable) {
+ return;
+ }
const target = _getEventTarget(event);
if (!this.origin.nativeElement.contains(target) && this.nzTrigger !== null) {
this.hide();
}
}
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?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information