Merge pull request #2393 from jbms/fix-instant-svg

Fix instant navigation when clicking on the logo button and logo is svg
This commit is contained in:
Martin Donath
2021-03-07 15:17:27 +01:00
committed by GitHub

View File

@@ -180,7 +180,9 @@ export function setupInstantLoading(
.pipe( .pipe(
filter(ev => !ev.metaKey && !ev.ctrlKey), filter(ev => !ev.metaKey && !ev.ctrlKey),
switchMap(ev => { 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") const el = ev.target.closest("a")
if (el && !el.target && urls.includes(el.href)) { if (el && !el.target && urls.includes(el.href)) {
ev.preventDefault() ev.preventDefault()