Skip to content

Commit 3085a93

Browse files
committed
fix(VOverlay): keep content attached to the activator on page with zoom
fixes #22326
1 parent 507f46e commit 3085a93

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/vuetify/src/util/animation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Box } from '@/util/box'
33

44
/** @see https://stackoverflow.com/a/57876601/2074736 */
55
export function nullifyTransforms (el: HTMLElement): Box {
6-
const rect = new Box(el.getBoundingClientRect())
6+
const rect = new Box(el)
77
const style = getComputedStyle(el)
88
const tx = style.transform
99

packages/vuetify/src/util/box.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ export class Box {
44
width: number
55
height: number
66

7-
constructor (args: DOMRect | {
7+
constructor (args: Element | {
88
x: number
99
y: number
1010
width: number
1111
height: number
1212
}) {
1313
const pageScale = document.body.currentCSSZoom ?? 1
14-
const ignoreZoom = (args as any).top === undefined // detect DOMRect without breaking in jsdom
15-
const factor = ignoreZoom ? 1 : 1 + (1 - pageScale) / pageScale
14+
const isElement = args instanceof Element
15+
const factor = isElement ? 1 + (1 - pageScale) / pageScale : 1
1616

17-
const { x, y, width, height } = args
17+
const { x, y, width, height } = isElement ? args.getBoundingClientRect() : args
1818

1919
this.x = x * factor
2020
this.y = y * factor
@@ -53,7 +53,7 @@ export function getTargetBox (target: HTMLElement | [x: number, y: number]): Box
5353
height: 0 * factor,
5454
})
5555
} else {
56-
return new Box(target.getBoundingClientRect())
56+
return new Box(target)
5757
}
5858
}
5959

@@ -76,6 +76,6 @@ export function getElementBox (el: HTMLElement) {
7676
})
7777
}
7878
} else {
79-
return new Box(el.getBoundingClientRect())
79+
return new Box(el)
8080
}
8181
}

0 commit comments

Comments
 (0)