Fix project scrolling running into null element

pull/6910/head
Oliver Günther 6 years ago
parent 040cb9f6c9
commit d8e4f8e464
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 10
      frontend/src/app/components/projects/project-menu-autocomplete/project-menu-autocomplete.component.ts

@ -300,8 +300,14 @@ export class ProjectMenuAutocompleteComponent extends ILazyAutocompleterBridge<I
}
private scrollCurrentProjectIntoView() {
let currentProject = document.getElementsByClassName('ui-menu-item-wrapper selected')[0] as HTMLElement;
let currentProjectHeight = currentProject.offsetHeight
let currentProject:HTMLElement|null = document.querySelector('.ui-menu-item-wrapper.selected');
// It can happen that no project is selected yet initially.
if (!currentProject) {
return;
}
let currentProjectHeight = currentProject.offsetHeight;
let scrollableContainer = document.getElementsByClassName('project-menu-autocomplete--results')[0];
// Scroll current project to top of the list and

Loading…
Cancel
Save