debug input
This commit is contained in:
@@ -57,7 +57,7 @@ import { Button } from 'primeng/button';
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
|
||||
// padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
|
||||
-webkit-overflow-scrolling: touch;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
@@ -133,6 +133,8 @@ export class SharedLightBottomsheetComponent implements OnInit, OnDestroy, OnCha
|
||||
|
||||
private originalParent: Node | null = null;
|
||||
private readonly defaultDrawerZIndex = 1102;
|
||||
private previousBodyOverflow = '';
|
||||
private previousBodyTouchAction = '';
|
||||
|
||||
constructor(
|
||||
private readonly elementRef: ElementRef<HTMLElement>,
|
||||
@@ -145,15 +147,20 @@ export class SharedLightBottomsheetComponent implements OnInit, OnDestroy, OnCha
|
||||
this.originalParent = host.parentNode;
|
||||
this.renderer.appendChild(this.document.body, host);
|
||||
this.syncZIndex();
|
||||
this.toggleBodyScrollLock(this.visible);
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (changes['visible'] && this.visible) {
|
||||
this.syncZIndex();
|
||||
}
|
||||
if (changes['visible']) {
|
||||
this.toggleBodyScrollLock(this.visible);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.toggleBodyScrollLock(false);
|
||||
this.removeDrawer();
|
||||
}
|
||||
|
||||
@@ -167,6 +174,7 @@ export class SharedLightBottomsheetComponent implements OnInit, OnDestroy, OnCha
|
||||
onVisibilityChange(nextValue: boolean) {
|
||||
this.visible = nextValue;
|
||||
this.visibleChange.emit(nextValue);
|
||||
this.toggleBodyScrollLock(nextValue);
|
||||
if (nextValue) {
|
||||
this.syncZIndex();
|
||||
}
|
||||
@@ -181,6 +189,28 @@ export class SharedLightBottomsheetComponent implements OnInit, OnDestroy, OnCha
|
||||
}
|
||||
}
|
||||
|
||||
private toggleBodyScrollLock(locked: boolean) {
|
||||
const body = this.document.body;
|
||||
if (!body) return;
|
||||
|
||||
if (locked) {
|
||||
if (!this.previousBodyOverflow) {
|
||||
this.previousBodyOverflow = body.style.overflow || '';
|
||||
}
|
||||
if (!this.previousBodyTouchAction) {
|
||||
this.previousBodyTouchAction = body.style.touchAction || '';
|
||||
}
|
||||
this.renderer.setStyle(body, 'overflow', 'hidden');
|
||||
this.renderer.setStyle(body, 'touch-action', 'none');
|
||||
return;
|
||||
}
|
||||
|
||||
this.renderer.setStyle(body, 'overflow', this.previousBodyOverflow);
|
||||
this.renderer.setStyle(body, 'touch-action', this.previousBodyTouchAction);
|
||||
this.previousBodyOverflow = '';
|
||||
this.previousBodyTouchAction = '';
|
||||
}
|
||||
|
||||
private syncZIndex() {
|
||||
const host = this.elementRef.nativeElement;
|
||||
const siblingDrawers = Array.from(
|
||||
|
||||
Reference in New Issue
Block a user