Skip to content

Commit f458819

Browse files
authored
fix(ui5-side-navigation): prevent TypeError when selected item has no DomRef (#12286)
fixes: #12261
1 parent ecccc86 commit f458819

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/fiori/src/SideNavigation.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,11 @@ class SideNavigation extends UI5Element {
534534

535535
if (selectedItem) {
536536
const selectedItemDomRef = selectedItem.getDomRef();
537-
const { marginTop, marginBottom } = window.getComputedStyle(selectedItemDomRef!);
538537

539-
itemsHeight += selectedItemDomRef!.offsetHeight + parseFloat(marginTop) + parseFloat(marginBottom);
538+
if (selectedItemDomRef) {
539+
const { marginTop, marginBottom } = window.getComputedStyle(selectedItemDomRef);
540+
itemsHeight += selectedItemDomRef.offsetHeight + parseFloat(marginTop) + parseFloat(marginBottom);
541+
}
540542
}
541543

542544
overflowItems.forEach(item => {

0 commit comments

Comments
 (0)