Attempt to stop scroll to bottom of page when clicking spacebar

This commit is contained in:
Tim Donohue
2021-09-30 17:11:34 -05:00
parent e5e6e9c07a
commit 7747a8c4e2
2 changed files with 3 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
<div class="nav-item dropdown expandable-navbar-section" <div class="nav-item dropdown expandable-navbar-section"
*ngVar="(active | async) as isActive" *ngVar="(active | async) as isActive"
(keyup.enter)="isActive ? deactivateSection($event) : activateSection($event)" (keyup.enter)="isActive ? deactivateSection($event) : activateSection($event)"
(keyup.space)="isActive ? deactivateSection($event) : activateSection($event)" (keyup.space)="$event.stopPropagation(); isActive ? deactivateSection($event) : activateSection($event)"
(mouseenter)="activateSection($event)" (mouseenter)="activateSection($event)"
(mouseleave)="deactivateSection($event)"> (mouseleave)="deactivateSection($event)">
<a href="#" class="nav-link dropdown-toggle" routerLinkActive="active" <a href="#" class="nav-link dropdown-toggle" routerLinkActive="active"

View File

@@ -42,6 +42,7 @@ export class ExpandableNavbarSectionComponent extends NavbarSectionComponent imp
* @param {Event} event The user event that triggered this function * @param {Event} event The user event that triggered this function
*/ */
activateSection(event): void { activateSection(event): void {
event.preventDefault();
this.windowService.isXsOrSm().pipe( this.windowService.isXsOrSm().pipe(
first() first()
).subscribe((isMobile) => { ).subscribe((isMobile) => {
@@ -57,6 +58,7 @@ export class ExpandableNavbarSectionComponent extends NavbarSectionComponent imp
* @param {Event} event The user event that triggered this function * @param {Event} event The user event that triggered this function
*/ */
deactivateSection(event): void { deactivateSection(event): void {
event.preventDefault();
this.windowService.isXsOrSm().pipe( this.windowService.isXsOrSm().pipe(
first() first()
).subscribe((isMobile) => { ).subscribe((isMobile) => {