Move code to make sure a clean-up happens on each run.

This commit is contained in:
2025-07-06 00:07:53 +02:00
parent ab914d8bf2
commit de558561b6
2 changed files with 5 additions and 5 deletions

View File

@ -21,6 +21,10 @@ export const Position = function(superClass) {
el.style.position = 'fixed';
el.style.zIndex = 1001;
// Reset max-height and overflow in case the element has been positioned before.
el.style.maxHeight = '';
el.style.overflowY = '';
// Test if the target is in a different stacking context.
el.style.left = '0px';
el.style.top = '0px';
@ -85,10 +89,6 @@ export const Position = function(superClass) {
if (elRect.height > availableHeight) {
el.style.maxHeight = availableHeight + 'px';
el.style.overflowY = 'auto';
} else {
// Reset max-height if element fits
el.style.maxHeight = '';
el.style.overflowY = '';
}
el.style.top = (top - fixTop) + 'px';