mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-25 05:02:57 +01:00
Minimap - Ensure that we correctly handle not found matched elements
- Currently the code appears to try to fallback to an empty id, however this will never happen as we are building a non-empty string - Instead if we have not found any closest panel, simply return the intersection map as is Closes #11210
This commit is contained in:
parent
901895c8d3
commit
0f44abeef2
@ -38,8 +38,9 @@ const mapIntersections = (
|
|||||||
acc: LinkIntersections,
|
acc: LinkIntersections,
|
||||||
{ target, isIntersecting }: IntersectionObserverEntry,
|
{ target, isIntersecting }: IntersectionObserverEntry,
|
||||||
) => {
|
) => {
|
||||||
const href = `#${target.closest('[data-panel]')?.id}` || '';
|
const id = target.closest('[data-panel]')?.id;
|
||||||
acc[href] = isIntersecting;
|
if (!id) return acc;
|
||||||
|
acc[`#${id}`] = isIntersecting;
|
||||||
return acc;
|
return acc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user