Open vursen opened 2 years ago
The modal overlays do make the body
element non-scrollable. In the case of the provided example, it's the document element that scrolls.
But it seems the <html>
can't be made non-scrollable using pointer-events: none
and toggling overflow
isn't an option either because it would dynamically change the layout for users that have the scrollbars always visible.
toggling overflow isn't an option either because it would dynamically change the layout for users that have the scrollbars always visible.
https://caniuse.com/mdn-css_properties_scrollbar-gutter
I wonder if this new scrollbar gutter property could be used somehow here.
The scrollbar-gutter
property doesn't appear to make the scrollbar space stable when it is only added as long as the overlay is open. If not using scrollbar-gutter
, adding overflow: hidden
may affect the layout which is not good.
There is also an alternative approach based on adding margin-right
when the document is scrollable:
https://github.com/elix/elix/blob/ed09212f8b3ec2e8f652e2f318e7c9c9707b709e/src/base/DialogModalityMixin.js#L67-L77
However, based on the internal discussion, we agreed to deprioritize this issue as it was considered not that critical after all.
Description
By default, as long as
modeless
attribute is not set, the overlay opens as a modal. In this state, it addspointer-events: none
to thebody
element which blocks scrolling for all the scrollable elements except the elements inside the overlay (note, its[part=overlay]
haspointer-events: auto
) and thebody
element itself.A finding from https://github.com/vaadin/web-components/issues/3540
Expected outcome
Either the
body
element should not be scrollable or other scrollable elements should be scrollable when the overlay is open.Minimal reproducible example
Snippet 1 (with app-layout):
Snippet 2 (without app-layout):
Steps to reproduce
Snippet 1 (with app-layout):
Snippet 2 (without app-layout):
Video
With app-layout:
https://user-images.githubusercontent.com/5039436/167784314-9e5fa854-3506-4ace-ba65-58a347f31f4e.mov
Without app-layout:
https://user-images.githubusercontent.com/5039436/167784206-437be1f9-74ac-44fc-9552-120fd921d999.mov
Environment
Vaadin version(s): 23
Browsers
No response