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: Use correct window to get the devicePixelRatio #2229

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/modifiers/computeStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ const unsetSides = {
// Round the offsets to the nearest suitable subpixel based on the DPR.
// Zooming can change the DPR, but it seems to report a value that will
// cleanly divide the values into the appropriate subpixels.
function roundOffsetsByDPR({ x, y }): Offsets {
const win: Window = window;
function roundOffsetsByDPR({ x, y }, win: Window): Offsets {
const dpr = win.devicePixelRatio || 1;

return {
Expand Down Expand Up @@ -150,7 +149,7 @@ export function mapToStyles({

({ x, y } =
roundOffsets === true
? roundOffsetsByDPR({ x, y })
? roundOffsetsByDPR({ x, y }, getWindow(popper))
: { x, y });

if (gpuAcceleration) {
Expand Down