-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DURACOM-195] Fix menu bar accessibility issues WIP
- Loading branch information
1 parent
4e550a3
commit 741be06
Showing
12 changed files
with
105 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
<nav [ngClass]="{'open': !(menuCollapsed | async)}" [@slideMobileNav]="!(windowService.isXsOrSm() | async) ? 'default' : ((menuCollapsed | async) ? 'collapsed' : 'expanded')" | ||
class="navbar navbar-light navbar-expand-md px-md-0 navbar-container" role="navigation" [attr.aria-label]="'nav.main.description' | translate" id="main-navbar"> | ||
<!-- TODO remove navbar-container class when https://github.com/twbs/bootstrap/issues/24726 is fixed --> | ||
<div class="navbar-inner-container w-100" [class.container]="!(isMobile$ | async)"> | ||
<div class="reset-padding-md w-100"> | ||
<div id="collapsingNav"> | ||
<ul class="navbar-nav align-items-md-center mr-auto shadow-none"> | ||
<li *ngIf="(isMobile$ | async) && (isAuthenticated$ | async)"> | ||
<ds-themed-user-menu [inExpandableNavbar]="true"></ds-themed-user-menu> | ||
</li> | ||
<li *ngFor="let section of (sections | async)"> | ||
<ng-container *ngComponentOutlet="(sectionMap$ | async).get(section.id)?.component; injector: (sectionMap$ | async).get(section.id)?.injector;"></ng-container> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
<nav [ngClass]="{'open': !(menuCollapsed | async)}" | ||
[@slideMobileNav]="!(windowService.isXsOrSm() | async) ? 'default' : ((menuCollapsed | async) ? 'collapsed' : 'expanded')" | ||
class="navbar navbar-light navbar-expand-md px-md-0 pt-md-0 pt-3 navbar-container" role="navigation" | ||
[attr.aria-label]="'nav.main.description' | translate" id="main-navbar"> | ||
<!-- TODO remove navbar-container class when https://github.com/twbs/bootstrap/issues/24726 is fixed --> | ||
<div class="navbar-inner-container w-100" [class.container]="!(isMobile$ | async)"> | ||
<div class="reset-padding-md w-100"> | ||
<div id="collapsingNav"> | ||
<ng-container *ngIf="(isMobile$ | async) && (isAuthenticated$ | async)"> | ||
<ds-themed-user-menu [inExpandableNavbar]="true"></ds-themed-user-menu> | ||
</ng-container> | ||
<ul class="navbar-nav align-items-md-center mr-auto shadow-none"> | ||
<ng-container *ngFor="let section of (sections | async)"> | ||
<ng-container | ||
*ngComponentOutlet="(sectionMap$ | async).get(section.id)?.component; injector: (sectionMap$ | async).get(section.id)?.injector;"></ng-container> | ||
</ng-container> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 18 additions & 16 deletions
34
src/app/shared/auth-nav-menu/auth-nav-menu.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,39 @@ | ||
<ul class="navbar-nav" [ngClass]="{'mr-auto': (isXsOrSm$ | async)}"> | ||
<li *ngIf="!(isAuthenticated | async) && !(isXsOrSm$ | async) && (showAuth | async)" class="nav-item" | ||
<ul class="navbar-nav mr-auto" *ngIf="!(isMobile$ | async); else mobileButtons"> | ||
<li *ngIf="!(isAuthenticated | async) && !(isMobile$ | async) && (showAuth | async)" class="nav-item" | ||
(click)="$event.stopPropagation();"> | ||
<div ngbDropdown #loginDrop display="dynamic" placement="bottom-right" class="d-inline-block" @fadeInOut> | ||
<a href="javascript:void(0);" class="dropdownLogin px-0.5" [attr.aria-label]="'nav.login' |translate" | ||
(click)="$event.preventDefault()" [attr.data-test]="'login-menu' | dsBrowserOnly" | ||
ngbDropdownToggle>{{ 'nav.login' | translate }}</a> | ||
<div class="loginDropdownMenu" [ngClass]="{'pl-3 pr-3': (loading | async)}" ngbDropdownMenu | ||
<div id="loginDropdownMenu" [ngClass]="{'pl-3 pr-3': (loading | async)}" ngbDropdownMenu | ||
[attr.aria-label]="'nav.login' | translate"> | ||
<ds-themed-log-in | ||
[isStandalonePage]="false"></ds-themed-log-in> | ||
</div> | ||
</div> | ||
</li> | ||
<li *ngIf="!(isAuthenticated | async) && (isXsOrSm$ | async)" class="nav-item"> | ||
<a routerLink="/login" routerLinkActive="active" class="loginLink px-0.5"> | ||
{{ 'nav.login' | translate }}<span class="sr-only">(current)</span> | ||
</a> | ||
</li> | ||
<li *ngIf="(isAuthenticated | async) && !(isXsOrSm$ | async) && (showAuth | async)" class="nav-item"> | ||
<li *ngIf="(isAuthenticated | async) && !(isMobile$ | async) && (showAuth | async)" class="nav-item"> | ||
<div ngbDropdown display="dynamic" placement="bottom-right" class="d-inline-block" @fadeInOut> | ||
<a href="javascript:void(0);" role="button" [attr.aria-label]="'nav.user-profile-menu-and-logout' |translate" (click)="$event.preventDefault()" [title]="'nav.user-profile-menu-and-logout' | translate" class="dropdownLogout px-1" [attr.data-test]="'user-menu' | dsBrowserOnly" ngbDropdownToggle> | ||
<i class="fas fa-user-circle fa-lg fa-fw"></i></a> | ||
<div class="logoutDropdownMenu" ngbDropdownMenu [attr.aria-label]="'nav.user-profile-menu-and-logout' |translate"> | ||
<ul id="logoutDropdownMenu" class="p-3" ngbDropdownMenu [attr.aria-label]="'nav.user-profile-menu-and-logout' |translate"> | ||
<ds-themed-user-menu></ds-themed-user-menu> | ||
</div> | ||
</ul> | ||
</div> | ||
</li> | ||
<li *ngIf="(isAuthenticated | async) && (isXsOrSm$ | async)" class="nav-item"> | ||
</ul> | ||
|
||
|
||
<ng-template #mobileButtons> | ||
<div *ngIf="!(isAuthenticated | async)"> | ||
<a routerLink="/login" routerLinkActive="active" class="loginLink px-0.5" role="button"> | ||
{{ 'nav.login' | translate }}<span class="sr-only">(current)</span> | ||
</a> | ||
</div> | ||
<div *ngIf="(isAuthenticated | async)"> | ||
<a role="button" [attr.aria-label]="'nav.logout' |translate" [title]="'nav.logout' | translate" routerLink="/logout" routerLinkActive="active" class="logoutLink px-1"> | ||
<i class="fas fa-sign-out-alt fa-lg fa-fw"></i> | ||
<span class="sr-only">(current)</span> | ||
</a> | ||
</li> | ||
</ul> | ||
|
||
|
||
</div> | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 23 additions & 10 deletions
33
src/app/shared/auth-nav-menu/user-menu/user-menu.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
<ds-themed-loading *ngIf="(loading$ | async)"></ds-themed-loading> | ||
<div *ngIf="!(loading$ | async)"> | ||
<span class="dropdown-item-text" [class.pl-0]="inExpandableNavbar"> | ||
<ul *ngIf="!(loading$ | async)" class="user-menu" role="menu"> | ||
<li class="menu-item-wrapper" role="presentation"> | ||
{{dsoNameService.getName(user$ | async)}}<br> | ||
<span class="text-muted">{{(user$ | async)?.email}}</span> | ||
</span> | ||
<a [ngClass]="inExpandableNavbar ? 'nav-item nav-link' : 'dropdown-item'" [routerLink]="[profileRoute]" routerLinkActive="active">{{'nav.profile' | translate}}</a> | ||
<a [ngClass]="inExpandableNavbar ? 'nav-item nav-link' : 'dropdown-item'" [routerLink]="[mydspaceRoute]" routerLinkActive="active">{{'nav.mydspace' | translate}}</a> | ||
<a [ngClass]="inExpandableNavbar ? 'nav-item nav-link' : 'dropdown-item'" [routerLink]="[subscriptionsRoute]" routerLinkActive="active">{{'nav.subscriptions' | translate}}</a> | ||
|
||
<div class="dropdown-divider"></div> | ||
<ds-log-out *ngIf="!inExpandableNavbar" data-test="log-out-component"></ds-log-out> | ||
</div> | ||
</li> | ||
<li class="menu-item-wrapper" role="presentation"> | ||
<a class="ds-menu-item" role="menuitem" | ||
[routerLink]="[profileRoute]" | ||
routerLinkActive="active">{{'nav.profile' | translate}}</a> | ||
</li> | ||
<li class="menu-item-wrapper" role="presentation"> | ||
<a class="ds-menu-item" role="menuitem" | ||
[routerLink]="[mydspaceRoute]" | ||
routerLinkActive="active">{{'nav.mydspace' | translate}}</a> | ||
</li> | ||
<li class="menu-item-wrapper" role="presentation"> | ||
<a class="ds-menu-item" role="menuitem" | ||
[routerLink]="[subscriptionsRoute]" | ||
routerLinkActive="active">{{'nav.subscriptions' | translate}}</a> | ||
</li> | ||
<li class="dropdown-divider" aria-hidden="true"></li> | ||
<li class="menu-item-wrapper" role="presentation"> | ||
<ds-log-out *ngIf="!inExpandableNavbar" data-test="log-out-component"></ds-log-out> | ||
</li> | ||
</ul> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
:host { | ||
ul.user-menu { | ||
list-style: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.ds-menu-item { | ||
display: inline-block; | ||
padding: 0.25rem 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters