Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Fix positioning edge case (fixes #837) #838

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mgreter
Copy link

@mgreter mgreter commented Sep 14, 2017

If the BODY has position: relative and overflow-x: hidden,
the offset is calculated incorrectly. It takes the BODY
scroll offset twice into the calculation. Also splits the
BODY overflow check/calculation into X/Y components.

Fixes #837

Not sure how correct this fix is, maybe the split into X/Y
scroll components isn't needed either. Not completely sure
I understand what the patched function is supposed to do.

If the BODY has position: relative and overflow-x: hidden,
the offset is calculated incorrectly. It takes the BODY
scroll offset twice into the calculation. Also splits the
BODY overflow check/calculation into X/Y components.
@m1lk1way
Copy link

m1lk1way commented Mar 7, 2018

hey, buddy. Its looks like we need to calculate x/y when container is not only body and its scrollable. Could you take a look at this issue? Maybe its related to your fix

@@ -238,15 +244,22 @@ PROTOTYPE.reposition.offset = function(elem, pos, container) {
pos.left -= parentOffset.left + (parseFloat($.css(parent, 'marginLeft')) || 0);
pos.top -= parentOffset.top + (parseFloat($.css(parent, 'marginTop')) || 0);

if (parent.tagName.toLowerCase() === 'BODY') { break; }
Copy link

@m1lk1way m1lk1way Mar 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't ever happen, cause "BODY".toLowerCase() won't be BODY

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just delete the line?

Copy link

@m1lk1way m1lk1way Dec 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free :) it doesnt work anyway

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I did not put it there for no reason, but your correct, it will of course not work.
I can only guess that I messed that one up when reviewing my PR before submitting.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong offset if body has position: relative and overflow-x: hidden
3 participants