Skip to content

Commit 6838092

Browse files
fix: move sticky toolbar dropdown to document.body to escape transform containing block
1 parent 64869d2 commit 6838092

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Resources/Public/JavaScript/sticky_toolbar.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@
339339
const menuBtn = this.container.querySelector('.frontend-edit__sticky-btn--menu');
340340
const dropdown = this.container.querySelector('.frontend-edit__sticky-dropdown');
341341

342+
// Move dropdown to document.body so position:fixed works correctly
343+
// (toolbar may have CSS transform which creates a new containing block)
344+
document.body.appendChild(dropdown);
345+
342346
menuBtn.addEventListener('click', async (e) => {
343347
e.stopPropagation();
344348
const isVisible = dropdown.classList.contains('frontend-edit__sticky-dropdown--visible');
@@ -351,7 +355,7 @@
351355
});
352356

353357
document.addEventListener('click', (e) => {
354-
if (!dropdownContainer.contains(e.target)) {
358+
if (!dropdownContainer.contains(e.target) && !dropdown.contains(e.target)) {
355359
dropdown.classList.remove('frontend-edit__sticky-dropdown--visible');
356360
}
357361
});

0 commit comments

Comments
 (0)