Skip to content

Commit ed7951d

Browse files
fix(module:modal,drawer): secondary overlays not scrolling inside (#8804)
1 parent 3b2fa01 commit ed7951d

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

components/drawer/drawer.component.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';
77
import { Direction, Directionality } from '@angular/cdk/bidi';
88
import { ESCAPE } from '@angular/cdk/keycodes';
9-
import { Overlay, OverlayConfig, OverlayKeyboardDispatcher, OverlayRef } from '@angular/cdk/overlay';
9+
import { CdkScrollable, Overlay, OverlayConfig, OverlayKeyboardDispatcher, OverlayRef } from '@angular/cdk/overlay';
1010
import { CdkPortalOutlet, ComponentPortal, PortalModule, TemplatePortal } from '@angular/cdk/portal';
1111
import { DOCUMENT, NgStyle, NgTemplateOutlet } from '@angular/common';
1212
import {
@@ -118,7 +118,7 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'drawer';
118118
}
119119
</div>
120120
}
121-
<div class="ant-drawer-body" [ngStyle]="nzBodyStyle">
121+
<div class="ant-drawer-body" [ngStyle]="nzBodyStyle" cdkScrollable>
122122
<ng-template cdkPortalOutlet />
123123
@if (nzContent) {
124124
@if (isNzContentTemplateRef) {
@@ -146,7 +146,15 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'drawer';
146146
preserveWhitespaces: false,
147147
changeDetection: ChangeDetectionStrategy.OnPush,
148148
animations: [drawerMaskMotion],
149-
imports: [NzNoAnimationDirective, NgStyle, NzOutletModule, NzIconModule, PortalModule, NgTemplateOutlet],
149+
imports: [
150+
NzNoAnimationDirective,
151+
NgStyle,
152+
NzOutletModule,
153+
NzIconModule,
154+
PortalModule,
155+
NgTemplateOutlet,
156+
CdkScrollable
157+
],
150158
standalone: true
151159
})
152160
export class NzDrawerComponent<T extends {} = NzSafeAny, R = NzSafeAny, D extends Partial<T> = NzSafeAny>

components/modal/modal-confirm-container.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
44
*/
55

6+
import { CdkScrollable } from '@angular/cdk/overlay';
67
import { CdkPortalOutlet, PortalModule } from '@angular/cdk/portal';
78
import { NgClass, NgStyle } from '@angular/common';
89
import {
@@ -91,6 +92,7 @@ import { BaseModalContainerComponent } from './modal-container.directive';
9192
</div>
9293
</div>
9394
`,
95+
hostDirectives: [CdkScrollable],
9496
animations: [nzModalAnimations.modalContainer],
9597
// Using OnPush for modal caused footer can not to detect changes. we can fix it when 8.x.
9698
changeDetection: ChangeDetectionStrategy.Default,

components/modal/modal-container.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import { CdkDrag, CdkDragHandle } from '@angular/cdk/drag-drop';
7+
import { CdkScrollable } from '@angular/cdk/overlay';
78
import { CdkPortalOutlet, PortalModule } from '@angular/cdk/portal';
89
import { NgClass, NgStyle } from '@angular/common';
910
import { ChangeDetectionStrategy, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
@@ -19,6 +20,7 @@ import { NzModalTitleComponent } from './modal-title.component';
1920
@Component({
2021
selector: 'nz-modal-container',
2122
exportAs: 'nzModalContainer',
23+
hostDirectives: [CdkScrollable],
2224
template: `
2325
<div
2426
#modalElement

0 commit comments

Comments
 (0)