mykiwi/mykiwi.blogpublic Fork
⑂ d35f746
Commits
⬇ Clone ▾
git clone https://git.rickub.com/mykiwi/mykiwi.blog.git
git clone ssh://git@rickub.com/mykiwi/mykiwi.blog.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

Replay masthead signal sweep on boosted navigation

innerMorph reuses the signal path's DOM node across htmx-boosted
navigation, only morphing its d attribute, so the signal-sweep
draw-in CSS animation never restarts on client-side nav - only on a
full page load. Force it to replay after every swap.
Romain Gautier committed 2026-09-20T01:28:01+02:00 Browse files
d35f746 parent: 1365852
modified blog/layouts/_default/baseof.html +16 -0
@@ -114,6 +114,22 @@
114114 request: {headers: {}, signal: restoreAbort.signal},
115115 });
116116 });
117+
118+ // innerMorph patches the masthead signal's <path> in place across a
119+ // boosted navigation rather than replacing it, so its `d` attribute
120+ // just morphs (see .masthead__signal path's `transition: d` in
121+ // style.scss) and the signal-sweep draw-in animation - which, being
122+ // a CSS animation on an element that never left the DOM, has no
123+ // "start" to trigger - never replays. Restart it by hand on every
124+ // swap so the line draws itself in on every navigation, not only a
125+ // full page load.
126+ document.body.addEventListener("htmx:after:swap", () => {
127+ const path = document.querySelector(".masthead__signal path");
128+ if (!path) return;
129+ path.style.animation = "none";
130+ path.getBoundingClientRect();
131+ path.style.animation = "";
132+ });
117133 });
118134 </script>
119135 {{ block "head" . }}{{ end }}
@@ -114,6 +114,22 @@
114 request: {headers: {}, signal: restoreAbort.signal},114 request: {headers: {}, signal: restoreAbort.signal},
115 });115 });
116 });116 });
117+
118+ // innerMorph patches the masthead signal's <path> in place across a
119+ // boosted navigation rather than replacing it, so its `d` attribute
120+ // just morphs (see .masthead__signal path's `transition: d` in
121+ // style.scss) and the signal-sweep draw-in animation - which, being
122+ // a CSS animation on an element that never left the DOM, has no
123+ // "start" to trigger - never replays. Restart it by hand on every
124+ // swap so the line draws itself in on every navigation, not only a
125+ // full page load.
126+ document.body.addEventListener("htmx:after:swap", () => {
127+ const path = document.querySelector(".masthead__signal path");
128+ if (!path) return;
129+ path.style.animation = "none";
130+ path.getBoundingClientRect();
131+ path.style.animation = "";
132+ });
117 });133 });
118 </script>134 </script>
119 {{ block "head" . }}{{ end }}135 {{ block "head" . }}{{ end }}