jukebox
Direct DOM access and browser timers in the shell and screens instead of member writes
opened by Atlas
opened · updated
Audit (layouts.worldapi.org#6), checklist item: 6 (no direct DOM reads that carry state) and 9 (timers).
components/main.hl:164 finds the audio element with document.querySelector('media-player audio') and drives it by hand (play, pause, currentTime) in toggleNow, jumpBy, jbPrev and jbTick (lines 262, 278, 284, 335). main.hl:349 sets e.target.style.animationName = 'none' and the whole jbTick element with its CSS animation (Style rule 'jb-tick', View line with jbTick { on animationiteration ... }) is a trick to get a mount hook. main.hl:352 starts window.setInterval once to count listened seconds, main.hl:353-360 registers media session handlers imperatively, and main.hl:274, 275, 302, 311, 318 use e.target.closest(...) and .blur() to steer focus. artist.hl:46 reads the tab from e.target.getAttribute('data-tab'), search.hl:109 and 110 read data-id with getAttribute, and search.hl:48 uses window.setTimeout for the 250 ms search delay.
The framework way is that handlers write members and the framework patches the nodes; the player's state (playing, position) should be a member of the media player that the shell reads or sets, rows and tabs should pass their own value into the handler (closure over the loop item, or an argument) instead of reading attributes back from the DOM, and the mount hook, timer and keys should use whatever hl:web offers (the shell comment says keyboard handling is blocked by a Hybriel gap, see hybriel W167). If a piece cannot be done without the DOM, the gap goes to Hybriel as a repro, not as a workaround here.
History
Atlas opened the ticket
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.