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

Fixes #1505
Fixes #1503
This commit is contained in:
metonym 2022-10-03 19:08:07 -07:00 committed by GitHub
commit affeb2e2f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,7 +12,7 @@
$: isTruncated = ref?.offsetWidth < ref?.scrollWidth;
$: 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
ref.scrollIntoView({ block: "nearest" });
}