Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private scrollToHash(hash: string = this.location.hash): void {
const behaviorAttribute = this.getAttribute('hash-scroll-behavior') as ScrollBehavior;
const hashId = hash.replace('#', '');
const hashElement = querySelectorDeep(`[id=${hashId}]`, this.shownPage) as HTMLElement;
if (hashElement) {
hashElement.scrollIntoView({ behavior: behaviorAttribute || 'auto' });
}
}