Skip to content

Commit 1a54234

Browse files
committed
Fix menu overflow for now.
this isn't a great permanent solution, but it works well enough for now. Ideally dropdowns used portals to get on top of other content.
1 parent 507c638 commit 1a54234

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

assets/js/webcomponents/modalWindow.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
class ModalWindow extends HTMLElement {
22
connectedCallback() {
33
const dialog = this.querySelector('dialog');
4+
if (!dialog) {
5+
console.error('No dialog element found');
6+
return;
7+
}
8+
49
dialog.showModal();
510

611
this.setupClose(dialog);
12+
13+
const selectbox = this.querySelector('select-box');
14+
if (selectbox) {
15+
// If there is a selectbox child, allow for the dropdown
16+
// to overflow. This isn't a perfect solution either but works ok.
17+
// in larger modals that have scroll, elements can overflow with this change.
18+
selectbox.addEventListener('open', function () {
19+
dialog.style.overflow = 'visible';
20+
});
21+
selectbox.addEventListener('close', function () {
22+
dialog.style.overflow = 'auto';
23+
});
24+
}
725
}
826

927
setupClose(dialog: HTMLDialogElement | null): void {

0 commit comments

Comments
 (0)