This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
[FRONT-626] Fix popover positioning in Safari when zoomed by pinching #2837
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Popover positioning is incorrect in Safari when you zoomed by pinching on the trackpad (or on iOS).
I found that floating-ui had the same issue a long time ago and they solved it by checking the user agent. It's not great, but there's no other solution I'm afraid (Safari just does it different/wrong 🤷♂️).
I tried replacing our popover with the Radix-ui popover, but radix doesn't allow you to disable the focus trap on the popover, which we need to fully support our current popover.
Manual check
To manual check this, you can't just open the popover story because that runs in an iframe. You need to open the actual iframe to test it out correctly. For example: http://localhost:3000/iframe.html?viewMode=docs&id=mid-level-blocks-popover--docs