coreui/coreui-angular

Modal: scroll disappears when `backdrop="false"`

Closed this issue · 2 comments

  • Operating system and version (Windows, macOS, Android, iOS) - macOS
  • Browser and version (Chrome, Firefox, Safari, Microsoft Edge, Opera, Android Browser) - chrome 136.0.7103.114
  • A reduced test case or suggested fix using CodePen or JS Bin
<button [cModalToggle]="myModal.id" cButton>
<c-modal id="myModal" #myModal [backdrop]="false" alignment="center">
  <c-modal-footer>
    <button [cModalToggle]="myModal.id" cButton color="secondary">close</button>
  </c-modal-footer>
</c-modal>

When the c-modal is activated and then closed using the close button, the body scroll disappears.

This issue occurs because the BackdropService calls hideScrollbar() but does not call resetScrollbar(). While hideScrollbar() is triggered during the animation regardless of whether backdrop="false" is set, resetScrollbar() is not.

This behavior needs to be fixed.

@tturbs confirmed, nice catch, thanks!

@tturbs fixed in ~5.4.13