Fix instant navigation when clicking on the logo button and logo is svg

This commit is contained in:
Jeremy Maitin-Shepard 2021-03-05 17:14:41 -08:00
parent 5d0cae7ca6
commit 3ee51acca2

View File

@ -180,7 +180,9 @@ export function setupInstantLoading(
.pipe(
filter(ev => !ev.metaKey && !ev.ctrlKey),
switchMap(ev => {
if (ev.target instanceof HTMLElement) {
// Check for `Element` rather than `HTMLElement` to also
// handle <svg> elements within <a> elements.
if (ev.target instanceof Element) {
const el = ev.target.closest("a")
if (el && !el.target && urls.includes(el.href)) {
ev.preventDefault()