w3c / webappsec-permissions-policy

A mechanism to selectively enable and disable browser features and APIs
https://w3c.github.io/webappsec-permissions-policy/
Other
396 stars 154 forks source link

Feature policy for not messing with scrolling? #171

Open kenchris opened 6 years ago

kenchris commented 6 years ago

Ie. so that thirdparty scripts etc cannot listen to scroll events or enforce "passive" on event handlers

clelland commented 6 years ago

@ehsan-karamad has been working on something that might match this -- specifically preventing frames from hijacking or interfering with the scrolling of their parent document.

ehsan-karamad commented 6 years ago

Right now we do have vertical-scroll mostly implemented serves some purpose here. Disabling the feature for a frame basically ensures:

That said, there are two "provisional" features ideas I wanted to followup on:

  1. A feature to enforce all listeners to be passive (i.e., touchstart, touchmove, wheel, etc).
  2. horizontal-scroll which is similar to vertical-scroll.

I think both 1 & 2 are good features depending on the use case.

Desentso commented 3 months ago

Any updates on this?

clelland commented 3 months ago

This is currently implemented in Chrome (and has been for some time now) but is still experimental. You can enable it by running Chrome either with "Experimental web platform features" turned on in chrome://flags, or from the command line with the flag

--enable-blink-features=ExperimentalPolicies

With either of those, a page which is framed with <iframe allow="vertical-scroll none">, or under a permissions-policy header like

Permissions-Policy: vertical-scroll=()

will be unable to hijack scrolling of its parent document.