Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use position fixed to ignore relative parent #50

Closed
wants to merge 1 commit into from

Conversation

vikfroberg
Copy link

When a list is created within an element that is position: relative the x and y is off. Using position: fixed instead of absolute however solves this since fixed ignores relative parents.

@vikfroberg
Copy link
Author

vikfroberg commented May 24, 2019

Face palm, can't use fixed since it's relative to scroll.

@vikfroberg vikfroberg closed this May 24, 2019
@annaghi
Copy link
Owner

annaghi commented May 27, 2019

I am back, because I have an idea.

Recently the mouse position is decoded from the event's context pageX and pageY, but what if we would use clientX and clientY? Here is a figure explaining the difference.

Can you try it out? The src/Internal/Common/Utils.elm should be modified:

pageX : Json.Decode.Decoder Float
pageX =
    Json.Decode.field "clientX" Json.Decode.float


pageY : Json.Decode.Decoder Float
pageY =
    Json.Decode.field "clientY" Json.Decode.float

@annaghi
Copy link
Owner

annaghi commented May 27, 2019

@vikfroberg

@vikfroberg
Copy link
Author

Awesome, I'll try that out!

@annaghi
Copy link
Owner

annaghi commented Sep 22, 2019

Hi @vikfroberg ,

I would like to reopen and merge your PR, because it solves the problem with position: relative parents.

As a workaround when I need to use scroll on parent I usually put the ghost element outside of that parent's scope.

Do you agree on merging your PR?

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

Successfully merging this pull request may close these issues.

2 participants