Skip to content

[css-overscroll] the target of overscroll-behavior should be scrolling box instead of scroll container? #6523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hiikezoe opened this issue Aug 17, 2021 · 6 comments

Comments

@hiikezoe
Copy link

An example;

<div style="height: 20vh; overflow: hidden; overscroll-behavior: none;">
  <div>overflow: hidden; overscroll-behavior: none;</div>
  <div style="height: 100vh; width: 100%;"></div>
</div>
<div style="height: 200vh; width: 100%;"></div>

In my understandings with the current spec text (i.e. "applied to scroll container"), scrolling on the overflow: hidden element shouldn't be handed off to the outer one, but in fact both Chrome and Firefox hand off it to the outer.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 22, 2021
…lable APZCs for scrolling handoff. r=botond

This behavior is not compliant with the CSS overscroll behavior spec.

The spec clearly explains that overscroll-behavior applies to scroll
container elements. But overflow: hidden elements can be scroll container
elements, thus the property should be respected in terms of the spec
definitions. That said, Chrome has been doing this behavior since 2017 [1],


[1] https://bugs.chromium.org/p/chromium/issues/detail?id=759209
[2] w3c/csswg-drafts#6523

Differential Revision: https://phabricator.services.mozilla.com/D122199
@hiikezoe
Copy link
Author

When I opened this issue, I was naively thinking all not-scrolling-box should not respect overscroll-behavior properties. That said, I think now, in the case of viewports things are a bit more complicated.

So for example, if the top level content document specifies overscroll-behavior: none, I am pretty sure such sites want to implement their own reload contents feature when the user swipe down the content or something like that. But if the document doesn't have enough contents to make it scrollable (i.e. make it a scrolling box), the site still wants to reload by swiping down? I am pretty sure it does.

Also note that if another website embeds such sites in iframes, users expect the embedded sites not to capture the swipe gestures, instead the users want to scroll the outer document if the embedded documents are not scrollable at all.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Aug 23, 2021
…lable APZCs for scrolling handoff. r=botond

This behavior is not compliant with the CSS overscroll behavior spec.

The spec clearly explains that overscroll-behavior applies to scroll
container elements. But overflow: hidden elements can be scroll container
elements, thus the property should be respected in terms of the spec
definitions. That said, Chrome has been doing this behavior since 2017 [1],


[1] https://bugs.chromium.org/p/chromium/issues/detail?id=759209
[2] w3c/csswg-drafts#6523

Differential Revision: https://phabricator.services.mozilla.com/D122199
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Aug 31, 2021
…lable APZCs for scrolling handoff. r=botond

This behavior is not compliant with the CSS overscroll behavior spec.

The spec clearly explains that overscroll-behavior applies to scroll
container elements. But overflow: hidden elements can be scroll container
elements, thus the property should be respected in terms of the spec
definitions. That said, Chrome has been doing this behavior since 2017 [1],


[1] https://bugs.chromium.org/p/chromium/issues/detail?id=759209
[2] w3c/csswg-drafts#6523

Differential Revision: https://phabricator.services.mozilla.com/D122199
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Aug 31, 2021
…lable APZCs for scrolling handoff. r=botond

This behavior is not compliant with the CSS overscroll behavior spec.

The spec clearly explains that overscroll-behavior applies to scroll
container elements. But overflow: hidden elements can be scroll container
elements, thus the property should be respected in terms of the spec
definitions. That said, Chrome has been doing this behavior since 2017 [1],


[1] https://bugs.chromium.org/p/chromium/issues/detail?id=759209
[2] w3c/csswg-drafts#6523

Differential Revision: https://phabricator.services.mozilla.com/D122199
@nanto
Copy link

nanto commented Nov 30, 2022

I think it's helpful if scrolling on an overflow: auto element with no scroll range doesn't hand off to outer elements. The major use case is to prevent background scrolling when a modal dialog is open.

Many people are looking for a way to prevent background scrolling when a modal dialog is open. Some people use body { overflow: hidden; } but this way has some problems:

  1. Needs JavaScript to know the timing to specify overflow: hidden to the body element.
  2. Scrollbar gutter disappears and the reflow happens on the content of the body element.

If scrolling on an element with no scroll range doesn't hand off, we can just write as dialog:modal { overscroll-behavior: contain; }. This way works as expected on Chrome canary 110 but doesn't work on Firefox nightly 109.

@hiikezoe
Copy link
Author

hiikezoe commented Dec 1, 2022

If scrolling on an element with no scroll range doesn't hand off, we can just write as dialog:modal { overscroll-behavior: contain; }. This way works as expected on Chrome canary 110 but doesn't work on Firefox nightly 109.

I tested it on Chrome Canary 110.0.5453.0, it does still hand off.

@hiikezoe
Copy link
Author

hiikezoe commented Dec 1, 2022

If scrolling on an element with no scroll range doesn't hand off, we can just write as dialog:modal { overscroll-behavior: contain; }. This way works as expected on Chrome canary 110 but doesn't work on Firefox nightly 109.

I found there's an open spec issue for such case.

@nanto
Copy link

nanto commented Dec 2, 2022

If scrolling on an element with no scroll range doesn't hand off, we can just write as dialog:modal { overscroll-behavior: contain; }. This way works as expected on Chrome canary 110 but doesn't work on Firefox nightly 109.

I tested it on Chrome Canary 110.0.5453.0, it does still hand off.

Sorry, my examination was incomplete. On Chrome, scrolling by mouse wheel or two-finger swipe doesn't hand off but scrolling by Arrow/PageUp/PageDown key does hand off.

I found there's an open spec issue for such case.

Thank you for letting me know!

@xPaw
Copy link

xPaw commented Aug 25, 2023

I think it's helpful if scrolling on an overflow: auto element with no scroll range doesn't hand off to outer elements. The major use case is to prevent background scrolling when a modal dialog is open.

I agree with this, overscroll-behavior is much less useful in my use cases even when overflow-y: scroll is set, but the element is not scrollable because it fits on the screen, which causes overscroll to still happen.

i3roly pushed a commit to i3roly/firefox-dynasty that referenced this issue Jun 1, 2024
…lable APZCs for scrolling handoff. r=botond

This behavior is not compliant with the CSS overscroll behavior spec.

The spec clearly explains that overscroll-behavior applies to scroll
container elements. But overflow: hidden elements can be scroll container
elements, thus the property should be respected in terms of the spec
definitions. That said, Chrome has been doing this behavior since 2017 [1],


[1] https://bugs.chromium.org/p/chromium/issues/detail?id=759209
[2] w3c/csswg-drafts#6523

Differential Revision: https://phabricator.services.mozilla.com/D122199
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this issue Jun 1, 2024
…lable APZCs for scrolling handoff. r=botond

This behavior is not compliant with the CSS overscroll behavior spec.

The spec clearly explains that overscroll-behavior applies to scroll
container elements. But overflow: hidden elements can be scroll container
elements, thus the property should be respected in terms of the spec
definitions. That said, Chrome has been doing this behavior since 2017 [1],


[1] https://bugs.chromium.org/p/chromium/issues/detail?id=759209
[2] w3c/csswg-drafts#6523

Differential Revision: https://phabricator.services.mozilla.com/D122199
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants