mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed invalid anchor list offset for hidden anchors
This commit is contained in:
parent
dee75ccfbb
commit
d4f5b1377c
@ -132,9 +132,18 @@ export function watchAnchorList(
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/* If the current anchor is hidden, continue with its parent */
|
||||
let offset = target.offsetTop
|
||||
while (!offset && target.parentElement) {
|
||||
target = target.parentElement
|
||||
offset = target.offsetTop
|
||||
}
|
||||
|
||||
/* Map reversed anchor path to vertical offset */
|
||||
return index.set(
|
||||
reverse(path = [...path, anchor]),
|
||||
target.offsetTop
|
||||
offset
|
||||
)
|
||||
}, new Map<HTMLAnchorElement[], number>())
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user