fix: remove inline onclick

This commit is contained in:
2026-05-26 22:35:02 +02:00
parent b63a5c48a2
commit 91bf399ebc
6 changed files with 102 additions and 52 deletions

View File

@@ -64,3 +64,25 @@ class UIDropdown extends HTMLElement {
}
customElements.define('ui-dropdown', UIDropdown);
const initStudioDropdown = (): void => {
document.addEventListener('click', e => {
const target = e.target;
if (!(target instanceof Element)) return;
const btn = target.closest<HTMLButtonElement>('button[data-studio-select]');
if (!btn) return;
const input = document.getElementById('studio-input') as HTMLInputElement | null;
const form = document.getElementById('browse-search-form') as HTMLFormElement | null;
if (!input || !form) return;
input.value = btn.dataset.studioSelect ?? '';
form.requestSubmit();
const dropdown = btn.closest('ui-dropdown') as { close?: () => void } | null;
dropdown?.close?.();
});
};
initStudioDropdown();