fix(list-box-menu-item): avoid element reference error

Fixes #1505
Fixes #1503
This commit is contained in:
Eric Liu 2022-10-03 18:50:15 -07:00
commit 68a83ac784

View file

@ -12,7 +12,7 @@
$: isTruncated = ref?.offsetWidth < ref?.scrollWidth; $: isTruncated = ref?.offsetWidth < ref?.scrollWidth;
$: title = isTruncated ? ref?.innerText : undefined; $: title = isTruncated ? ref?.innerText : undefined;
$: if (highlighted && !ref?.matches(":hover")) { $: if (highlighted && ref && !ref.matches(":hover")) {
// Scroll highlighted item into view if using keyboard navigation // Scroll highlighted item into view if using keyboard navigation
ref.scrollIntoView({ block: "nearest" }); ref.scrollIntoView({ block: "nearest" });
} }