Skip to content

Fix(cdk/overlay) : adaptation of clientRect according to the zoom level #20467

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

Conversation

Gwe-n
Copy link

@Gwe-n Gwe-n commented Sep 1, 2020

Fixed a bug on the cdk/overlay that was incorrectly positioned when the parent element contained a zoom level different from 1. The zoom level is applied on the bottom, left and top properties in order to adapt the positioning.

Fixes #10924

Fixed a bug on the cdk/overlay that was incorrectly positioned when the parent element contained a zoom level different from 1. The zoom level is applied on the bottom, left and top properties in order to adapt the positioning.

Fixes angular#10924
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Sep 1, 2020
@Gwe-n
Copy link
Author

Gwe-n commented Sep 1, 2020

I think it's a bad idea to use the css "zoom" property since it's not standard
https://developer.mozilla.org/en-US/docs/Web/CSS/zoom

but maybe the people who commented the ticket need it for a reason I don't know. I wonder if they would be better off using transform: scale() instead. 

But out of curiosity, I've looked at what should be done to fix this problem, I would have to modify the properties of getBoundingClientRect depending on the zoom value of the parent element.

@jelbourn
Copy link
Member

jelbourn commented Sep 1, 2020

@Gwe-n yeah, I'm not sure we'd want to add handling for this since the property is non-standard, having now looked at the original issue more closely. Adding this support increases the complexity of the code and would require corresponding tests.

@crisbeto
Copy link
Member

crisbeto commented Sep 1, 2020

To add to what was said above, we'd basically have to do it for all places where getBoundingClientRect is called. Furthermore, there are other cases like the native browser zoom that this won't handle.

@Gwe-n
Copy link
Author

Gwe-n commented Sep 1, 2020

To add to what was said above, we'd basically have to do it for all places where getBoundingClientRect is called. Furthermore, there are other cases like the native browser zoom that this won't handle.

I don't think there's a problem with the browser zoom on this subject, am I wrong?

@crisbeto
Copy link
Member

crisbeto commented Sep 1, 2020

Ah sorry, I think I misremembered #10924 for being about the native browser zoom. I just double-checked it and it works fine.

@nlevari
Copy link

nlevari commented Dec 14, 2020

@Gwe-n This happens also with transform: scale()!
Setting scale on the body is an easy fix to support those HiDPI screen, which makes everything huge in some OS.
Please considering fixing it or help me find an easy workaround.

@Gwe-n
Copy link
Author

Gwe-n commented Dec 15, 2020

@nlevari If I take the initial problem with the stackblitz example, and apply a transform: scale(x) instead of a zoom I do not reproduce the problem.

https://stackblitz.com/edit/cdk-overlay-zoom-fugydj


But maybe I didn't understand the whole problem. If you also have the issue with transform, can you provide a sample code? Thank you.

(are you sure we are talking about the same problem? because I have the impression that you are talking about applying a scale to the body)

@nlevari
Copy link

nlevari commented Dec 20, 2020

@Gwe-n You are right, I am talking about applying scale to the body.
I'm sorry, I followed this bug progress and ended up here. Thought it is connected. (you closed all other bugs relevant to scale)

@andrewseguin andrewseguin removed the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 28, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CDK Overlay - Position Strategy with zoom css on parent
6 participants