Skip to content

Commit

Permalink
Fix errors in firefox extension when destructuring the window (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
WillDonohoe authored Feb 19, 2023
1 parent 880190f commit da888ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/firefox-getcomputedstyle-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@dnd-kit/core": patch
---

Fix errors with calls to `getComputedStyle` in Firefox when destructuring from the window object
4 changes: 2 additions & 2 deletions packages/core/src/utilities/rect/getRect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export function getClientRect(
let rect: ClientRect = element.getBoundingClientRect();

if (options.ignoreTransform) {
const {getComputedStyle} = getWindow(element);
const {transform, transformOrigin} = getComputedStyle(element);
const {transform, transformOrigin} =
getWindow(element).getComputedStyle(element);

if (transform) {
rect = inverseTransform(rect, transform, transformOrigin);
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/utilities/scroll/getScrollableAncestors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export function getScrollableAncestors(
return scrollParents;
}

const {getComputedStyle} = getWindow(node);
const computedStyle = getComputedStyle(node);
const computedStyle = getWindow(element).getComputedStyle(node);

if (node !== element) {
if (isScrollable(node, computedStyle)) {
Expand Down

0 comments on commit da888ee

Please sign in to comment.