Skip to content
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

Add scroll bubbling monkeypatches #71

Merged
merged 15 commits into from
Jul 31, 2023
29 changes: 29 additions & 0 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ spec: permissions-policy; urlPrefix: https://w3c.github.io/webappsec-permissions
type: dfn
for: permissions policy
text: inherited policy; url: inherited-policy
spec: css2; urlPrefix: https://www.w3.org/TR/CSS21/visuren.html
type: dfn
for: css2
text: viewport; url: viewport
</pre>

<style>
Expand Down Expand Up @@ -2444,6 +2448,31 @@ algorithms to achieve the outcomes described in the above explanatory content.
/fenced-frame/permission-notification.https.html
</wpt>

<h3 id=cssom-monkeypatch>CSSOM View</h3>
blu25 marked this conversation as resolved.
Show resolved Hide resolved

The [[!CSSOM-VIEW]] specification defines the {{Element/scrollIntoView()}} method that calls the
[=scroll a target into view=] algorithm. This will not only scroll the {{Element}} or
[=css2/viewport=] to make the target visible, but will also scroll [=tree/ancestor=]s if necessary
to make the target visible, essentially causing the scroll to "bubble up". This means that
{{Element/scrollIntoView()}} performed in a [=child navigable=] or [=fenced navigable container/
fenced navigable=] can be observed by its embedder, allowing for collusion across a fenced frame
boundary. This section patches the [=scroll a target into view=] algorithm to prevent that collusion
at the expense of some utility.

<div algorithm=scroll-target-into-view>
Modify the [=scroll a target into view=] algorithm to add a step at the end of the algorithm that
reads:

14. If <var ignore>scrolling box</var>'s associated {{Element}}'s associated {{Document}}'s [=node
navigable=]'s [=navigable/traversable navigable=] is a [=fenced navigable container/fenced
navigable=], or if <var ignore>scrolling box</var>'s associated [=css2/viewport=]'s associated
{{Document}}'s [=node navigable=]'s [=navigable/traversable navigable=] is a [=fenced navigable
container/fenced navigable=], then let this be the last instance of this algorithm that stops
any further recursive instances that would otherwise follow.

Note: This allows scrolling to "bubble up" to a fenced frame boundary, but not cross it.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh one more thing, do we have any tests that we can point to here in a <wpt> block?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, no. But we have an item in the fenced frame tracker to migrate the browsertests over to WPTs.

</div>

<h2 id=security-and-privacy>Security & Privacy Considerations</h2>

This material is being upstreamed from our explainer into this specification, and in the meantime
Expand Down