V12 - sidebar doesn't remove mask
disableModality() {
if (this.mask) {
DomHandler.addClass(this.mask, 'p-component-overlay-leave');
this.animationEndListener = this.destroyModal.bind(this);
this.mask.addEventListener('animationend', this.animationEndListener);
}
}
destroyModal() {
this.unbindMaskClickListener();
document.body.removeChild(this.mask);
if (this.blockScroll) {
DomHandler.removeClass(document.body, 'p-overflow-hidden');
}
this.unbindAnimationEndListener();
this.mask = null;
}
doesn't trigger destroyModal()
This is still not fixed. Since mask element is after the sidebar when we set appendTo="body" and the click event on buttons which are placed inside the sidebar components are not preventDefault, then animationend event not triggered. We used custom buttons to close the sidebar.
Its still not working. Easy fix could be add event listener with useCaptue as true
@jiangyh1024 Please reopen this bug
Still exists in 12.2.0
I have looked into this a little. It appears that the animationEndListener that's supposed to destroy the overlay is removed before the panel is entirely hidden. This is done through unbindGlobalListeners
onAnimationEnd(event) {
switch (event.toState) {
case 'void':
this.hide(); // Binds `destroyModal` to the mask `animationend`
ZIndexUtils.clear(this.container);
this.unbindGlobalListeners(); // Removes `destroyModal` from the mask immediately
break;
}
}
A possible solution is to simply move the hide to after the unbindGlobalListeners.
On second thought, I think unbindAnimationEndListener should be removed from unbindGlobalListeners
seems fixed, when to release a new version
I am still seeing this issue in our project after updating to 12.2.1. Neither the 2-way binding to [(visible)] nor clicking off the sidebar [dismissible]="true" clears the mask.
try what I did in #10715, I think it could fix this issue as a makeshift.
Thanks for the suggestion, @jiangyh1024. I have added a ViewChild(Sidebar) and tried to call hide() on it manually prior to setting the [(visible)] binding to false in our component controller per your recommended work-around, but the mask still remains after the sidebar closes.
I do not think that this issue should be closed.
I have been unable to reproduce the problem using the Sidebar Stackblitz example, but this issue still occurs in our PWA under PrimeNG 12.2.1 & Angular 12.2.10. However, I found I could work-around the problem by manually calling destroyModal() onHide:
<p-sidebar
#NavSideBar
(onHide)="NavSideBar.destroyModal()"
[(visible)]="navigationPaneIsOpen"
[blockScroll]="true"
[showCloseIcon]="false"
styleClass="p-0"
appendTo="body">
...
</p-sidebar>
Thx, that would be helpful
I can still reproduce the issue in the version 12.2.1. The problem is that the p-component-overlay div is not removed when the sidebar is closed. To reproduce the issue you cannot use a theme because in the theme there are some css transitions to remove the panel. So, my workaround is add the next lines (copied to one theme) to my style.scss file
.p-component-overlay-enter {
animation: p-component-overlay-enter-animation 150ms forwards;
}
.p-component-overlay-leave {
animation: p-component-overlay-leave-animation 150ms forwards;
}
@keyframes p-component-overlay-enter-animation {
from {
background-color: transparent;
}
to {
background-color: var(--maskbg);
}
}
@keyframes p-component-overlay-leave-animation {
from {
background-color: var(--maskbg);
}
to {
background-color: transparent;
}
}
Anyway I attach a minimal angular project to reproduce the issue
Thanks, @smarrerof. Those CSS animations fix the problem and eliminate the need for the work-around I previously posted in our project, which doesn't use a standard PrimeNG theme and was missing those .p-component-overlay-* selectors in our custom theme SCSS.
Thanks @smarrerof. I can confirm that the problem persists, but this workaround works.
Many thanks , @smarrerof , your workaround is effective and smart. Issue should be reopened , and maybe fixed with it :)
Why is this closed if it is still broken? I have the problem with 12.2.2
Still present in latest 12.x version. Please fix.
Also still present for me with 12.2.2
Confirm, bug is still present in 12.2.2
Still present in 13 RC2
Is this still present in 13.0.2?