ember-basic-dropdown icon indicating copy to clipboard operation
ember-basic-dropdown copied to clipboard

Improve calculate position for custom destination element

Open markusm7 opened this issue 5 years ago • 0 comments

At the moment in the default calculateWormholedPosition function, the scroll of the window is taken into account, even if the anchor element of the destination isn't the body and relative/absolute positioned. This results in a problem where scrolling adds an unnecessary top/left offset to the position of the EBD content element.

Maybe we could set the scroll offsets to 0 (or prevent the addition to the triggerLeft/triggerTop) if the anchorPosition is relative or absolute (or even fixed??)?

I saw there is already a minor fix for the body relative thingy, but with my suggestion this would fix it regardless of the anchorElement/anchorPosition and the isBodyPositionRelative-fix could be removed, or am i missing something?

And yes i can override the calculatePosition, but the rest works absolutly as i want it to work so overriding it for just this seems a bit odd :)

The isBodyPositionRelative-fix (https://github.com/cibernox/ember-basic-dropdown/pull/333) tackled the same issue, but only for default destination with the body as anchorElement and only the top scroll, if some pages use horizontal scroll it would cause the same issue :)

markusm7 avatar Oct 01 '19 16:10 markusm7