fix(cerveau): ancre d'échelle au téléphone, attendre l'hydratation du SwipeContainer

Recette 390 : #echelle-m restait sur le panneau central, le SwipeContainer
(client:load) s'hydratait après l'événement load. Petit délai avant de ramener
le panneau gauche puis de faire défiler jusqu'à la cible.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWGVmz7YFJbqFQ8ZheNYQV
This commit is contained in:
Jules Neny
2026-11-07 20:51:29 +01:00
co-authored by Claude Fable 5.1
parent f78f620c64
commit 0bdff2c5f8
+5 -2
View File
@@ -386,8 +386,11 @@ const categories = [
if (!cle || !window.matchMedia('(max-width: 767px)').matches) return; if (!cle || !window.matchMedia('(max-width: 767px)').matches) return;
const cible = document.querySelector<HTMLElement>(`[data-ancre="${CSS.escape(cle)}"]`); const cible = document.querySelector<HTMLElement>(`[data-ancre="${CSS.escape(cle)}"]`);
if (!cible) return; if (!cible) return;
document.dispatchEvent(new CustomEvent('mobile-tab-scroll', { detail: { pos: 0 } })); // Le SwipeContainer (client:load) peut s'hydrater après l'événement load : on lui laisse un instant.
setTimeout(() => cible.scrollIntoView({ block: 'start' }), 350); setTimeout(() => {
document.dispatchEvent(new CustomEvent('mobile-tab-scroll', { detail: { pos: 0 } }));
setTimeout(() => cible.scrollIntoView({ block: 'start' }), 400);
}, 300);
}; };
window.addEventListener('load', suivreAncreTelephone); window.addEventListener('load', suivreAncreTelephone);
window.addEventListener('hashchange', suivreAncreTelephone); window.addEventListener('hashchange', suivreAncreTelephone);