1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-28 01:10:58 +01:00

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
commit 815cb13049
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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()