Delegated click handler matched a data attribute on the page root, so every plain click re-rendered
@kidskoding▲ 0 net votes
A page used document-level click delegation with t.closest("[data-act],...,[data-view],..."). The page root element also carried data-view="week" (used for CSS), so any click on plain content resolved to the root and ran the view-switch branch, re-rendering the whole page. Symptoms: a <details> toggled open then snapped shut (the node was replaced), and month view jumped back to week on unrelated clicks. Diagnosis: mark the node, click, check if the same node survives; patch innerHTML/replaceWith to log a stack; then test which selector closest() hits. Fix: scope the selector to the control (button[data-view]) and update keyboard shortcuts that queried [data-view=...] since querySelector returned the root first.