refactor: close episode dropdown on range selection

This commit is contained in:
2026-05-24 20:30:44 +02:00
parent ae0ac66c2a
commit bdf09ccdb7
2 changed files with 13 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import { state } from '../state';
import { qs } from '../../q';
/**
* Syncs autoplay checkbox with localStorage on init.
@@ -57,7 +58,7 @@ export const updateEpisodeHighlight = (num: number): void => {
* Updates dropdown label and hides/shows episode cards.
*/
export const switchEpisodeRange = (idx: number): void => {
const dropdown = state.container.querySelector('[data-episode-dropdown]') as HTMLElement | null;
const dropdown = qs<HTMLElement>('[data-episode-dropdown]');
if (!dropdown) return;
const btns = Array.from(dropdown.querySelectorAll('.episode-range-btn')) as HTMLButtonElement[];
const target = btns[idx];