diff --git a/src/sql/workbench/contrib/notebook/browser/notebook.component.ts b/src/sql/workbench/contrib/notebook/browser/notebook.component.ts index 5b9b09d32a..a6e8c9145c 100644 --- a/src/sql/workbench/contrib/notebook/browser/notebook.component.ts +++ b/src/sql/workbench/contrib/notebook/browser/notebook.component.ts @@ -760,22 +760,9 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe } navigateToSection(id: string): void { - id = id.toLowerCase(); - let chromeHeight: number = 0; - let elBody: HTMLElement = document.body; - let tabBar = elBody.querySelector('.title.tabs') as HTMLElement; - let actionBar = elBody.querySelector('.editor-toolbar.actionbar-container') as HTMLElement; - let section = this.getSectionElements().find(s => s.relativeUri && s.relativeUri.toLowerCase() === id); + let section = this.getSectionElements().find(s => s.relativeUri && s.relativeUri.toLowerCase() === id.toLowerCase()); if (section) { - // Scroll this section to the top of the header instead of just bringing header into view. - if (tabBar && actionBar) { - chromeHeight = tabBar.scrollHeight + actionBar.scrollHeight; - } - let scrollTop: number = section.headerEl.getBoundingClientRect().top - (chromeHeight + 10); - (this.container.nativeElement).scrollTo({ - top: scrollTop, - behavior: 'smooth' - }); + section.headerEl.scrollIntoView({ behavior: 'smooth', block: 'start' }); section.headerEl.focus(); } }