mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 04:53:06 +00:00
130479: add aria-selected to selected language + globe button uses a button element
This commit is contained in:
@@ -1,17 +1,18 @@
|
|||||||
<div ngbDropdown class="navbar-nav" *ngIf="moreThanOneLanguage" display="dynamic" placement="bottom-right">
|
<div ngbDropdown class="navbar-nav" *ngIf="moreThanOneLanguage" display="dynamic" placement="bottom-right">
|
||||||
<a href="javascript:void(0);" role="button"
|
<button role="button"
|
||||||
[attr.aria-label]="'nav.language' |translate"
|
[attr.aria-label]="'nav.language' |translate"
|
||||||
[title]="'nav.language' | translate" class="px-1"
|
[title]="'nav.language' | translate" class="dropdown-toggle px-1"
|
||||||
(click)="$event.preventDefault()" data-toggle="dropdown" ngbDropdownToggle
|
(click)="$event.preventDefault()" data-toggle="dropdown" ngbDropdownToggle
|
||||||
tabindex="0">
|
tabindex="0">
|
||||||
<i class="fas fa-globe-asia fa-lg fa-fw"></i>
|
<i class="fas fa-globe-asia fa-lg fa-fw"></i>
|
||||||
</a>
|
</button>
|
||||||
<ul ngbDropdownMenu class="dropdown-menu" [attr.aria-label]="'nav.language' |translate">
|
<div ngbDropdownMenu class="dropdown-menu" role="listbox" [attr.aria-label]="'nav.language' |translate">
|
||||||
<li class="dropdown-item" tabindex="0" #langSelect *ngFor="let lang of translate.getLangs()"
|
<div class="dropdown-item" tabindex="0" role="option" *ngFor="let lang of translate.getLangs()"
|
||||||
(keyup.enter)="useLang(lang)"
|
(keyup.enter)="useLang(lang)"
|
||||||
(click)="useLang(lang)"
|
(click)="useLang(lang)"
|
||||||
[class.active]="lang === translate.currentLang">
|
[attr.aria-selected]="lang === translate.currentLang"
|
||||||
{{ langLabel(lang) }}
|
[class.active]="lang === translate.currentLang">
|
||||||
</li>
|
{{ langLabel(lang) }}
|
||||||
</ul>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-toggle {
|
.dropdown-toggle {
|
||||||
|
all: unset;
|
||||||
color: var(--ds-header-icon-color);
|
color: var(--ds-header-icon-color);
|
||||||
|
|
||||||
&:hover, &:focus {
|
&:hover, &:focus {
|
||||||
|
@@ -109,7 +109,7 @@ describe('LangSwitchComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should define the main A HREF in the UI', (() => {
|
it('should define the main A HREF in the UI', (() => {
|
||||||
expect(langSwitchElement.querySelector('a')).not.toBeNull();
|
expect(langSwitchElement.querySelector('button.dropdown-toggle')).not.toBeNull();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('when selecting a language', () => {
|
describe('when selecting a language', () => {
|
||||||
|
Reference in New Issue
Block a user