Help for Instructors
diff --git a/src/web/app/pages-help/instructor-help-page/instructor-help-page.component.ts b/src/web/app/pages-help/instructor-help-page/instructor-help-page.component.ts
index 5ac8de99a974..432802f4bef8 100644
--- a/src/web/app/pages-help/instructor-help-page/instructor-help-page.component.ts
+++ b/src/web/app/pages-help/instructor-help-page/instructor-help-page.component.ts
@@ -1,5 +1,5 @@
import { DOCUMENT } from '@angular/common';
-import { AfterViewInit, Component, ElementRef, Inject, ViewChild } from '@angular/core';
+import { AfterViewInit, Component, Inject, ViewChild } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { PageScrollService } from 'ngx-page-scroll-core';
import { environment } from '../../../environments/environment';
@@ -42,7 +42,6 @@ export class InstructorHelpPageComponent implements AfterViewInit {
questionIdToExpand: string = '';
section: string = '';
- @ViewChild('helpPage') bodyRef ?: ElementRef;
@ViewChild('studentsHelpSection') studentsHelpSection?: InstructorHelpStudentsSectionComponent;
@ViewChild('coursesHelpSection') coursesHelpSection?: InstructorHelpCoursesSectionComponent;
@ViewChild('sessionsHelpSection') sessionsHelpSection?: InstructorHelpSessionsSectionComponent;
@@ -104,13 +103,10 @@ export class InstructorHelpPageComponent implements AfterViewInit {
* Scrolls to the section passed in
*/
scroll(section: string): void {
- if (this.bodyRef) {
- const el: any = Array.prototype.slice
- .call(this.bodyRef.nativeElement.childNodes).find((x: any) => x.id === section);
- if (el) {
- el.scrollIntoView();
- window.scrollBy(0, -50);
- }
+ const el: HTMLElement | null = this.document.getElementById(section);
+ if (el) {
+ const y: number = el.getBoundingClientRect().top + window.scrollY - 70;
+ window.scrollTo({ top: y, behavior: 'auto' });
}
}