dialog
dialog copied to clipboard
Prevent page jump when opening the dialog
When we open the dialog, we remove the page scrollbar, which causes a layout jump.
@tonivj5 wdyt?
Could you add a repro or an example? I don't see any layout jump in https://ngneat.github.io/dialog/
It's happennig in the playground. Toggle the dialog and focus on the end of this block:
Use this button to toggle it:
I've been looking for a solution, and it seems to be a bit harder to fix. I've checked how ng-bootstrap does it, it compensates the scrollbar gap adding a synthetic right padding, simulating scrollbar is there. We could take the same approach.
Others thoughts:
- Do nothing as Angular material does (if body has scrollbar, doesn't hide it)
- Or add a class to body/html indicating dialog is opened, and let the user to add his logic if he want to hide scroll and handle reflow.
wdty @NetanelBasal?
I think we should follow the Angular material approach. But pay attention that it needs to behave the same:
- Don't hide the scrollbar
- Prevent scrolling
@tonivj5 any progress here?