diff --git a/src/app/root/root.component.spec.ts b/src/app/root/root.component.spec.ts
index 2bcbc673f3f..a1ccbfc21d8 100644
--- a/src/app/root/root.component.spec.ts
+++ b/src/app/root/root.component.spec.ts
@@ -72,4 +72,20 @@ describe('RootComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ describe('skip-to-main-content link', () => {
+ it('should be rendered as an anchor pointing to #main-content', () => {
+ const skipLink = fixture.nativeElement.querySelector('#skip-to-main-content');
+ expect(skipLink).not.toBeNull();
+ expect(skipLink.tagName).toBe('A');
+ expect(skipLink.getAttribute('href')).toBe('#main-content');
+ });
+
+ it('should target a element with tabindex="-1" so the anchor can move focus', () => {
+ const mainContent = fixture.nativeElement.querySelector('#main-content');
+ expect(mainContent).not.toBeNull();
+ expect(mainContent.tagName).toBe('MAIN');
+ expect(mainContent.getAttribute('tabindex')).toBe('-1');
+ });
+ });
});
diff --git a/src/app/root/root.component.ts b/src/app/root/root.component.ts
index e237736eb66..2493aa264ae 100644
--- a/src/app/root/root.component.ts
+++ b/src/app/root/root.component.ts
@@ -134,14 +134,6 @@ export class RootComponent implements OnInit {
}
}
- skipToMainContent() {
- const mainContent = document.getElementById('main-content');
- if (mainContent) {
- mainContent.tabIndex = -1;
- mainContent.focus();
- }
- }
-
getBrowserName(): string {
const userAgent = this._window.nativeWindow.navigator?.userAgent;
if (/Firefox/.test(userAgent)) {