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

[css-viewport] zoom and scroll propagation to the viewport. #9911

Closed
emilio opened this issue Feb 5, 2024 · 5 comments · Fixed by #10054
Closed

[css-viewport] zoom and scroll propagation to the viewport. #9911

emilio opened this issue Feb 5, 2024 · 5 comments · Fixed by #10054
Assignees

Comments

@emilio
Copy link
Collaborator

emilio commented Feb 5, 2024

When document.scrollingElement == document.body (so, in quirks mode when the <body> is propagated to the viewport), things like document.body.scrollTop return the viewport scroll position etc.

The question then becomes, with something like:

<!quirks-mode>
<body style="zoom: 2">
  <div style="height: 3000px"></div>
  <script>
  onload = () => {
    document.body.scrollTop;
    document.body.scrollTop = 500;
  };
  </script>
</body>

Should those coordinates be unscaled by the <body> zoom or not?

I think Chrome's behavior is not unzooming them, which makes sense to me.

cc @chrishtr @smfr

@zcorpan
Copy link
Member

zcorpan commented Feb 6, 2024

zoom on body doesn't itself propagate to the viewport, so the viewport's coordinates shouldn't be affected. That's what I get in Chrome and Safari, if I understand correctly.

Demo: https://software.hixie.ch/utilities/js/live-dom-viewer/saved/12346

@emilio
Copy link
Collaborator Author

emilio commented Feb 6, 2024

Yes, I think that's the sensible thing.

@chrishtr
Copy link
Contributor

chrishtr commented Mar 5, 2024

Should we just close this issue then? Or is a spec PR needed to clarify?

@emilio
Copy link
Collaborator Author

emilio commented Mar 5, 2024

A clarification would be great, or at least making sure that there's a test, because right now reading the spec it could go one way or the other. I can try to write a test for this sometime soon.

@chrishtr
Copy link
Contributor

chrishtr commented Mar 5, 2024

A clarification would be great, or at least making sure that there's a test, because right now reading the spec it could go one way or the other. I can try to write a test for this sometime soon.

Ok I'll make a PR clarifying. Thanks for the test!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants