Improve link detection robustness on summary clicks

This commit is contained in:
2026-05-04 14:04:18 +02:00
parent a2b2357c83
commit 215635df6c

View File

@@ -504,7 +504,8 @@ window.addEventListener('DOMContentLoaded', async () => {
}
summaryHTML.addEventListener('click', (event) => {
const link = event.target.closest('a[href]');
const target = event.target instanceof Element ? event.target : null;
const link = target?.closest('a[href]');
if (!link || !summaryHTML.contains(link)) {
return;
}