diff --git a/src/Explorer/Tree/AccessibleVerticalList.ts b/src/Explorer/Tree/AccessibleVerticalList.ts index 818328a41..96db22df8 100644 --- a/src/Explorer/Tree/AccessibleVerticalList.ts +++ b/src/Explorer/Tree/AccessibleVerticalList.ts @@ -8,7 +8,7 @@ enum ScrollPosition { export class AccessibleVerticalList { private items: any[] = []; - private onSelect: (item: any) => void; + private onSelect?: (item: any) => void; public currentItemIndex: ko.Observable; public currentItem: ko.Computed; @@ -42,7 +42,9 @@ export class AccessibleVerticalList { const targetElement = targetContainer .getElementsByClassName("accessibleListElement") .item(this.currentItemIndex()); - this.scrollElementIntoContainerViewIfNeeded(targetElement, targetContainer, ScrollPosition.Top); + if (targetElement) { + this.scrollElementIntoContainerViewIfNeeded(targetElement, targetContainer, ScrollPosition.Top); + } return false; } if (event.keyCode === 40) { @@ -52,7 +54,9 @@ export class AccessibleVerticalList { const targetElement = targetContainer .getElementsByClassName("accessibleListElement") .item(this.currentItemIndex()); - this.scrollElementIntoContainerViewIfNeeded(targetElement, targetContainer, ScrollPosition.Bottom); + if (targetElement) { + this.scrollElementIntoContainerViewIfNeeded(targetElement, targetContainer, ScrollPosition.Top); + } return false; } return true; diff --git a/tsconfig.strict.json b/tsconfig.strict.json index 8b947e2c4..2a7da5bcd 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -59,6 +59,7 @@ "./src/Explorer/Notebook/NotebookComponent/types.ts", "./src/Explorer/Notebook/NotebookContentItem.ts", "./src/Explorer/Notebook/NotebookUtil.ts", + "./src/Explorer/Tree/AccessibleVerticalList.ts", "./src/Explorer/Panes/PaneComponents.ts", "./src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts", "./src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts",