Keep dropdowns open through re-renders
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fd85580466
commit
bb56d618df
1 changed files with 7 additions and 1 deletions
|
|
@ -658,7 +658,8 @@ function render() {
|
|||
setHtml($("#top"), topbar());
|
||||
// The fires keep burning through a re-render: put the old canvases back in place of the new ones.
|
||||
const burning = [...document.querySelectorAll("canvas[data-flame]")];
|
||||
setHtml($("#main"), S.me ? pageHtml() : register());
|
||||
// Replacing a focused dropdown closes it mid-pick: hold the page until it lets go.
|
||||
if (!document.activeElement?.matches("#main select")) setHtml($("#main"), S.me ? pageHtml() : register());
|
||||
for (const old of burning) {
|
||||
const fresh = document.querySelector(`canvas[data-flame="${old.dataset.flame}"]`);
|
||||
if (fresh && fresh !== old) fresh.replaceWith(old);
|
||||
|
|
@ -3030,7 +3031,12 @@ document.addEventListener("input", (e) => {
|
|||
render();
|
||||
});
|
||||
|
||||
document.addEventListener("focusout", (e) => {
|
||||
if (S && e.target.matches("#main select")) setTimeout(render);
|
||||
});
|
||||
|
||||
document.addEventListener("change", (e) => {
|
||||
if (e.target.matches("#main select")) e.target.blur();
|
||||
if (e.target.dataset.qset) {
|
||||
const n = Math.floor(Number(e.target.value));
|
||||
if (!(n >= 1 && n <= C.make_max)) return toast(`1 to ${fmt(C.make_max)}`, "bad");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue