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

fix(cdk/overlay): fix positioning when zooming in Safari #24160

Merged
merged 1 commit into from
Jan 6, 2022

Conversation

jeripeierSBB
Copy link
Contributor

Currently, when zooming in Safari in macOS and iOS the overlay is positioned
at the wrong place, offset by the zoom offset (left / top).
This fix corrects this by adding/subtracting the corresponding offset.

Screenshot in Safari 15.1 on macOS with activated zoom:
Bildschirmfoto 2022-01-04 um 15 47 25

// of the screen and to make space for the virtual keyboard. We need to account for this offset,
// otherwise our positioning will be thrown off.
// Additionally, when zooming in Safari this fixes the vertical position.
y -= containerRect.top;
Copy link
Member

Choose a reason for hiding this comment

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

Just to be on the safe side, shouldn't we check whether top is negative like we do above with left?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the check. I did not add the check before since there was already no check when the expression was in the method _getExactOverlayY (there to fix virtual keyboard offset).

Currently, when zooming in Safari in macOS and iOS the overlay is positioned
at the wrong place, offset by the zoom offset (left/top).
This fix corrects this by adding/subtracting the corresponding offset.
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

LGTM

@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Jan 5, 2022
@wagnermaciel wagnermaciel merged commit a6d21a1 into angular:master Jan 6, 2022
wagnermaciel pushed a commit that referenced this pull request Jan 6, 2022
Currently, when zooming in Safari in macOS and iOS the overlay is positioned
at the wrong place, offset by the zoom offset (left/top).
This fix corrects this by adding/subtracting the corresponding offset.

(cherry picked from commit a6d21a1)
@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 Feb 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants