Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion addon/utils/calculate-position.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,17 @@ export function calculateWormholedPosition(trigger, content, destination, { hori
}

// Calculate vertical position
let triggerTopWithScroll = triggerTop + scroll.top;
let triggerTopWithScroll = triggerTop;

/**
* Fixes bug where the dropdown always stays on the same position on the screen when
* the <body> is relatively positioned
*/
let isBodyPositionRelative = window.getComputedStyle(document.body).getPropertyValue('position') === 'relative';
if (!isBodyPositionRelative) {
triggerTopWithScroll += scroll.top;
}

if (verticalPosition === 'above') {
style.top = triggerTopWithScroll - dropdownHeight;
} else if (verticalPosition === 'below') {
Expand Down