Skip to content

Commit

Permalink
Remove another extraneous focus
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyEJohnson committed Nov 14, 2024
1 parent a500d28 commit 47251c8
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/app/content/components/Page/scrollToTopOrHashManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,10 @@ const scrollToTargetOrTop = (container: HTMLElement | null, hash: string, previo
if (getScrollTarget(container, hash)) {
scrollToTarget(container, hash);
} else if (previous) {
scrollToTop();
assertWindow().scrollTo(0, 0);
}
};

const scrollToTop = () => {
const window = assertWindow();
const document = window.document;

document.querySelector('main')?.focus();
window.scrollTo(0, 0);
};

const getScrollTarget = (container: HTMLElement | null, hash: string): HTMLElement | null => {
return container && typeof(window) !== 'undefined' && hash
? container.querySelector(`[id="${hash.replace(/^#/, '')}"]`)
Expand Down

0 comments on commit 47251c8

Please sign in to comment.