fix combo dropdown: position:fixed escapes modal scroll, blank inputs in map modals

- Combo dropdown now uses position:fixed with JS-calculated viewport coords so it
  never causes the modal's overflow-y:auto container to scroll
- MapLinkModal: map filter and link text both start blank; link text auto-fills
  on map selection only if still empty
- SubmapPickerModal: focus opens all maps (blank query)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
isaprettycoolguy@protonmail.com 2026-05-23 12:35:34 -04:00
parent 31d3256192
commit ff8479c59c
4 changed files with 24 additions and 11 deletions

View file

@ -697,6 +697,12 @@ export class HexEditorModal extends HexmakerModal {
const openDropdown = () => {
isOpen = true;
populateDropdown(input.value);
const rect = comboWrap.getBoundingClientRect();
dropdown.setCssProps({
top: `${rect.bottom + 2}px`,
left: `${rect.left}px`,
width: `${rect.width}px`,
});
dropdown.show();
};

View file

@ -31,7 +31,6 @@ export class MapLinkModal extends HexmakerModal {
}
let selectedMap = maps[0].name;
let linkTextDirty = false;
let linkTextInput!: HTMLInputElement;
// ── Map combo ─────────────────────────────────────────────────────────
@ -48,7 +47,7 @@ export class MapLinkModal extends HexmakerModal {
cls: "duckmage-link-combo-input",
attr: { placeholder: "Filter maps…" },
});
mapInput.value = selectedMap;
mapInput.value = "";
comboWrap.createEl("button", {
text: "▾",
@ -80,7 +79,7 @@ export class MapLinkModal extends HexmakerModal {
e.preventDefault();
selectedMap = m.name;
mapInput.value = m.name;
if (!linkTextDirty) linkTextInput.value = m.name;
if (!linkTextInput.value.trim()) linkTextInput.value = m.name;
closeDropdown();
});
}
@ -89,6 +88,12 @@ export class MapLinkModal extends HexmakerModal {
const openDropdown = (query: string) => {
isOpen = true;
populateDropdown(query);
const rect = comboWrap.getBoundingClientRect();
dropdown.setCssProps({
top: `${rect.bottom + 2}px`,
left: `${rect.left}px`,
width: `${rect.width}px`,
});
dropdown.show();
};
@ -97,7 +102,7 @@ export class MapLinkModal extends HexmakerModal {
dropdown.hide();
};
mapInput.addEventListener("focus", () => openDropdown(mapInput.value));
mapInput.addEventListener("focus", () => openDropdown(""));
mapInput.addEventListener("blur", () => setTimeout(() => closeDropdown(), 150));
mapInput.addEventListener("input", () => {
if (!isOpen) openDropdown(mapInput.value);
@ -112,8 +117,7 @@ export class MapLinkModal extends HexmakerModal {
.setName("Link text")
.addText((t) => {
linkTextInput = t.inputEl;
t.setValue(selectedMap)
.onChange(() => { linkTextDirty = true; });
t.setValue("");
});
// ── Buttons ───────────────────────────────────────────────────────────

View file

@ -90,6 +90,12 @@ export class SubmapPickerModal extends HexmakerModal {
const openDropdown = (query: string) => {
isOpen = true;
populateDropdown(query);
const rect = comboWrap.getBoundingClientRect();
dropdown.setCssProps({
top: `${rect.bottom + 2}px`,
left: `${rect.left}px`,
width: `${rect.width}px`,
});
dropdown.show();
};

View file

@ -847,11 +847,8 @@ input.duckmage-input-error {
}
.duckmage-link-combo-dropdown {
position: absolute;
top: calc(100% + 2px);
left: 0;
right: 0;
z-index: 100;
position: fixed;
z-index: 300;
background: var(--background-primary);
border: 1px solid var(--background-modifier-border);
border-radius: 4px;