|
| 1 | +@let isAuthenticated = (isAuthenticated$ | async); |
1 | 2 | @if ((isMobile$ | async) !== true) { |
2 | 3 | <div class="navbar-nav me-auto" data-test="auth-nav"> |
3 | | - @if ((isAuthenticated | async) !== true && (showAuth | async)) { |
| 4 | + @let showAuth = (showAuth$ | async); |
| 5 | + @if (isAuthenticated !== true && showAuth) { |
4 | 6 | <div |
5 | 7 | class="nav-item" |
6 | 8 | (click)="$event.stopPropagation();"> |
7 | 9 | <div ngbDropdown #loginDrop="ngbDropdown" display="dynamic" placement="bottom-right" class="d-inline-block" @fadeInOut> |
8 | | - <a href="javascript:void(0);" class="dropdownLogin px-0.5" [attr.aria-label]="'nav.login' |translate" |
9 | | - (click)="$event.preventDefault()" [attr.data-test]="'login-menu' | dsBrowserOnly" |
10 | | - role="menuitem" |
11 | | - tabindex="0" |
12 | | - aria-haspopup="menu" |
13 | | - aria-controls="loginDropdownMenu" |
14 | | - [attr.aria-expanded]="loginDrop.isOpen()" |
15 | | - ngbDropdownToggle>{{ 'nav.login' | translate }}</a> |
| 10 | + <button class="dropdownLogin btn btn-link px-0" [attr.aria-label]="'nav.login' |translate" |
| 11 | + (click)="$event.preventDefault()" [attr.data-test]="'login-menu' | dsBrowserOnly" |
| 12 | + role="button" |
| 13 | + tabindex="0" |
| 14 | + aria-haspopup="menu" |
| 15 | + aria-controls="loginDropdownMenu" |
| 16 | + [attr.aria-expanded]="loginDrop.isOpen()" |
| 17 | + ngbDropdownToggle> |
| 18 | + {{ 'nav.login' | translate }} |
| 19 | + </button> |
16 | 20 | <div id="loginDropdownMenu" [ngClass]="{'ps-3 pe-3': (loading | async)}" ngbDropdownMenu |
17 | | - role="menu" |
| 21 | + role="dialog" |
| 22 | + aria-modal="true" |
18 | 23 | [attr.aria-label]="'nav.login' | translate"> |
19 | 24 | <ds-log-in |
20 | 25 | [isStandalonePage]="false"></ds-log-in> |
21 | 26 | </div> |
22 | 27 | </div> |
23 | 28 | </div> |
24 | 29 | } |
25 | | - @if ((isAuthenticated | async) && (showAuth | async)) { |
| 30 | + @if (isAuthenticated && showAuth) { |
26 | 31 | <div class="nav-item"> |
27 | 32 | <div ngbDropdown #loggedInDrop="ngbDropdown" display="dynamic" placement="bottom-right" class="d-inline-block" @fadeInOut> |
28 | | - <a href="javascript:void(0);" |
29 | | - role="menuitem" |
| 33 | + <button |
| 34 | + role="button" |
30 | 35 | tabindex="0" |
31 | 36 | [attr.aria-label]="'nav.user-profile-menu-and-logout' | translate" |
32 | 37 | aria-controls="user-menu-dropdown" |
33 | 38 | (click)="$event.preventDefault()" [title]="'nav.user-profile-menu-and-logout' | translate" |
34 | | - class="dropdownLogout px-1" |
| 39 | + class="dropdownLogout btn btn-link px-0" |
35 | 40 | [attr.data-test]="'user-menu' | dsBrowserOnly" |
36 | 41 | ngbDropdownToggle> |
37 | | - <i class="fas fa-user-circle fa-lg fa-fw"></i></a> |
38 | | - <div id="logoutDropdownMenu" ngbDropdownMenu> |
39 | | - <ds-user-menu [inExpandableNavbar]="false" (changedRoute)="loggedInDrop.close()"></ds-user-menu> |
40 | | - </div> |
| 42 | + <i class="fas fa-user-circle fa-lg fa-fw"></i> |
| 43 | + </button> |
| 44 | + <div id="logoutDropdownMenu" ngbDropdownMenu> |
| 45 | + <ds-user-menu [inExpandableNavbar]="false" (changedRoute)="loggedInDrop.close()"></ds-user-menu> |
41 | 46 | </div> |
42 | 47 | </div> |
43 | | - } |
44 | | - </div> |
45 | | - } @else { |
46 | | - <div data-test="auth-nav"> |
47 | | - @if ((isAuthenticated | async) !== true) { |
48 | | - <a routerLink="/login" routerLinkActive="active" class="loginLink px-0.5" role="button" tabindex="0"> |
49 | | - {{ 'nav.login' | translate }}<span class="sr-only">(current)</span> |
50 | | - </a> |
51 | | - } |
52 | | - @if ((isAuthenticated | async)) { |
53 | | - <a role="button" [attr.aria-label]="'nav.logout' |translate" [title]="'nav.logout' | translate" routerLink="/logout" routerLinkActive="active" class="logoutLink px-1" role="button" tabindex="0"> |
54 | | - <i class="fas fa-sign-out-alt fa-lg fa-fw"></i> |
55 | | - <span class="sr-only">(current)</span> |
56 | | - </a> |
57 | | - } |
58 | | - </div> |
59 | | - } |
60 | | - |
61 | | - |
| 48 | + </div> |
| 49 | + } |
| 50 | + </div> |
| 51 | +} @else { |
| 52 | + <div data-test="auth-nav"> |
| 53 | + @if (isAuthenticated === true) { |
| 54 | + <a [attr.aria-label]="'nav.logout' |translate" [title]="'nav.logout' | translate" routerLink="/logout" routerLinkActive="active" class="logoutLink px-0" role="link" tabindex="0"> |
| 55 | + <i class="fas fa-sign-out-alt fa-lg fa-fw"></i> |
| 56 | + <span class="sr-only">(current)</span> |
| 57 | + </a> |
| 58 | + } @else { |
| 59 | + <a routerLink="/login" routerLinkActive="active" class="loginLink px-0" role="link" tabindex="0"> |
| 60 | + {{ 'nav.login' | translate }}<span class="sr-only">(current)</span> |
| 61 | + </a> |
| 62 | + } |
| 63 | + </div> |
| 64 | +} |
62 | 65 |
|
63 | | - <!-- Do not use ul/li in this menu as it breaks e2e accessibility tests --> |
| 66 | +<!-- Do not use ul/li in this menu as it breaks e2e accessibility tests --> |
0 commit comments