Skip to content

Commit

Permalink
Merge pull request #680 from mkszepp/fix-position-fixed-for-v0-35
Browse files Browse the repository at this point in the history
Backport to v0.35: fix offset calculation for position fixed elements
  • Loading branch information
mkszepp authored Jun 21, 2023
2 parents 53d6596 + f9701de commit 13490ed
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion addon/transitions/explode.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function _explodePart(context, field, childContext, selector, seen) {
}

function getOffset(ele) {
const rect = ele.getBoundingClientRect();
const rect = ele?.getBoundingClientRect() ?? { top: 0, left: 0 };
return {
top: rect.top + window.scrollY,
left: rect.left + window.scrollX,
Expand Down
2 changes: 1 addition & 1 deletion addon/transitions/fly-to.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function flyTo(opts = {}) {
}

function getOffset(ele) {
const rect = ele.getBoundingClientRect();
const rect = ele?.getBoundingClientRect() ?? { top: 0, left: 0 };
return {
top: rect.top + window.scrollY,
left: rect.left + window.scrollX,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/transitions/explode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ module('Integration: explode transition', function (hooks) {
});

function getOffset(ele) {
const rect = ele.getBoundingClientRect();
const rect = ele?.getBoundingClientRect() ?? { top: 0, left: 0 };
return {
top: rect.top + window.scrollY,
left: rect.left + window.scrollX,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/transitions/fly-to-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ module('Integration: fly-to transition', function (hooks) {
});

function getOffset(ele) {
const rect = ele.getBoundingClientRect();
const rect = ele?.getBoundingClientRect() ?? { top: 0, left: 0 };
return {
top: rect.top + window.scrollY,
left: rect.left + window.scrollX,
Expand Down

0 comments on commit 13490ed

Please sign in to comment.