Skip to content

Commit

Permalink
fix(dom): stop findPosition at a fullscreenElement (#7074)
Browse files Browse the repository at this point in the history
On iPads, if the player is inside a floating div, when fullscreen, we'll have an incorrect offset value. Instead, we should stop counting our offsets once we get to our fullscreen element (i.e. the player) because in fullscreen it's outside the regular flow, and we don't actually want to add offset the float gives us inline.
  • Loading branch information
gkatsev authored Feb 3, 2021
1 parent d546364 commit 541f2e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/js/utils/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
import document from 'global/document';
import window from 'global/window';
import fs from '../fullscreen-api';
import log from './log.js';
import {isObject} from './obj';
import computedStyle from './computed-style';
Expand Down Expand Up @@ -564,12 +565,12 @@ export function findPosition(el) {
let left = 0;
let top = 0;

do {
while (el.offsetParent && el !== document[fs.fullscreenElement]) {
left += el.offsetLeft;
top += el.offsetTop;

el = el.offsetParent;
} while (el);
}

return {
left,
Expand Down

0 comments on commit 541f2e5

Please sign in to comment.