Skip to content

Commit d2756f9

Browse files
Merge pull request #16236 from primefaces/issue-16233
Fixed #16233 - Sidebar: Overlay of Nested Sidebar Blocks Its Own Content
2 parents c13745a + 428aad0 commit d2756f9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/app/components/sidebar/sidebar.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,13 @@ export class Sidebar implements AfterViewInit, AfterContentInit, OnDestroy {
328328
}
329329

330330
enableModality() {
331+
const activeDrawers = this.document.querySelectorAll('.p-sidebar-active');
332+
const activeDrawersLength = activeDrawers.length;
333+
const zIndex = activeDrawersLength == 1 ? String(parseInt((this.container as HTMLDivElement).style.zIndex) - 1) : String(parseInt((activeDrawers[0] as HTMLElement).style.zIndex) - 1);
334+
331335
if (!this.mask) {
332336
this.mask = this.renderer.createElement('div');
333-
this.renderer.setStyle(this.mask, 'zIndex', String(parseInt((this.container as HTMLDivElement).style.zIndex) - 1));
337+
this.renderer.setStyle(this.mask, 'zIndex', zIndex);
334338
DomHandler.addMultipleClasses(this.mask, 'p-component-overlay p-sidebar-mask p-component-overlay p-component-overlay-enter');
335339

336340
if (this.dismissible) {

0 commit comments

Comments
 (0)