Skip to content

Commit 4ee15fc

Browse files
committed
Fixed errors on modal & popup open
1 parent 640b0a7 commit 4ee15fc

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

components/modal/modal.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,12 @@ export class SuiModal<T, U> implements OnInit, AfterViewInit {
210210
private updateScroll() {
211211
const fontSize = parseFloat(window.getComputedStyle(document.documentElement, null).getPropertyValue('font-size'));
212212
const margin = fontSize * 3.5;
213-
const element = this._modalElement.nativeElement as Element;
214-
215-
this._mustScroll = !this._mustAlwaysScroll && window.innerHeight < element.clientHeight + margin * 2;
213+
214+
if (this._modalElement) {
215+
const element = this._modalElement.nativeElement as Element;
216+
217+
this._mustScroll = !this._mustAlwaysScroll && window.innerHeight < element.clientHeight + margin * 2;
218+
}
216219
}
217220

218221
@HostListener("document:keyup", ["$event"])

components/util/positioning.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ export class PositioningService {
113113
}
114114

115115
public get actualPlacement() {
116+
if (!this._popperState) {
117+
return PositioningPlacement.Inherit;
118+
}
119+
116120
return popperToPlacement(this._popperState.placement);
117121
}
118122

0 commit comments

Comments
 (0)