mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-19 01:51:27 +01:00
[PS-266] A11y: change tabbed interface to toggle buttons, correctly announce currently active tab as pressed (#2505)
* Change routerLink links to button elements * Set aria-pressed attribute on button depending on routerLinkActive * Change base styles to apply to tabs that use `<button>` instead of `<a>`
This commit is contained in:
parent
a02e966da4
commit
2cafed758f
@ -316,7 +316,8 @@ header {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
a {
|
a,
|
||||||
|
button {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
display: block;
|
display: block;
|
||||||
padding: 7px 0;
|
padding: 7px 0;
|
||||||
@ -325,6 +326,7 @@ header {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
@include themify($themes) {
|
@include themify($themes) {
|
||||||
color: themed("mutedColor");
|
color: themed("mutedColor");
|
||||||
@ -345,7 +347,8 @@ header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
a {
|
a,
|
||||||
|
button {
|
||||||
@include themify($themes) {
|
@include themify($themes) {
|
||||||
color: themed("primaryColor");
|
color: themed("primaryColor");
|
||||||
}
|
}
|
||||||
|
@ -2,30 +2,50 @@
|
|||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
<ul>
|
<ul>
|
||||||
<li routerLinkActive="active" *ngIf="showCurrentTab">
|
<li routerLinkActive="active" #rlaCurrentTab="routerLinkActive" *ngIf="showCurrentTab">
|
||||||
<a routerLink="current" appA11yTitle="{{ 'currentTab' | i18n }}">
|
<button
|
||||||
|
routerLink="current"
|
||||||
|
appA11yTitle="{{ 'currentTab' | i18n }}"
|
||||||
|
[attr.aria-pressed]="rlaCurrentTab.isActive"
|
||||||
|
>
|
||||||
<i class="bwi bwi-folder-closed-f bwi-2x" aria-hidden="true"></i>{{ "tab" | i18n }}
|
<i class="bwi bwi-folder-closed-f bwi-2x" aria-hidden="true"></i>{{ "tab" | i18n }}
|
||||||
</a>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li routerLinkActive="active">
|
<li routerLinkActive="active" #rlaMyVault="routerLinkActive">
|
||||||
<a routerLink="vault" appA11yTitle="{{ 'myVault' | i18n }}">
|
<button
|
||||||
|
routerLink="vault"
|
||||||
|
appA11yTitle="{{ 'myVault' | i18n }}"
|
||||||
|
[attr.aria-pressed]="rlaMyVault.isActive"
|
||||||
|
>
|
||||||
<i class="bwi bwi-lock-f bwi-2x" aria-hidden="true"></i>{{ "myVault" | i18n }}
|
<i class="bwi bwi-lock-f bwi-2x" aria-hidden="true"></i>{{ "myVault" | i18n }}
|
||||||
</a>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li routerLinkActive="active">
|
<li routerLinkActive="active" #rlaSend="routerLinkActive">
|
||||||
<a routerLink="send" appA11yTitle="{{ 'send' | i18n }}">
|
<button
|
||||||
|
routerLink="send"
|
||||||
|
appA11yTitle="{{ 'send' | i18n }}"
|
||||||
|
[attr.aria-pressed]="rlaSend.isActive"
|
||||||
|
>
|
||||||
<i class="bwi bwi-send-f bwi-2x" aria-hidden="true"></i>{{ "send" | i18n }}
|
<i class="bwi bwi-send-f bwi-2x" aria-hidden="true"></i>{{ "send" | i18n }}
|
||||||
</a>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li routerLinkActive="active">
|
<li routerLinkActive="active" #rlaGenerator="routerLinkActive">
|
||||||
<a routerLink="generator" appA11yTitle="{{ 'passGen' | i18n }}">
|
<button
|
||||||
|
routerLink="generator"
|
||||||
|
appA11yTitle="{{ 'passGen' | i18n }}"
|
||||||
|
[attr.aria-pressed]="rlaGenerator.isActive"
|
||||||
|
>
|
||||||
<i class="bwi bwi-generate-f bwi-2x" aria-hidden="true"></i>{{ "generator" | i18n }}
|
<i class="bwi bwi-generate-f bwi-2x" aria-hidden="true"></i>{{ "generator" | i18n }}
|
||||||
</a>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li routerLinkActive="active">
|
<li routerLinkActive="active" #rlaSettings="routerLinkActive">
|
||||||
<a routerLink="settings" appA11yTitle="{{ 'settings' | i18n }}">
|
<button
|
||||||
|
routerLink="settings"
|
||||||
|
appA11yTitle="{{ 'settings' | i18n }}"
|
||||||
|
[attr.aria-pressed]="rlaSettings.isActive"
|
||||||
|
>
|
||||||
<i class="bwi bwi-cog-f bwi-2x" aria-hidden="true"></i>{{ "settings" | i18n }}
|
<i class="bwi bwi-cog-f bwi-2x" aria-hidden="true"></i>{{ "settings" | i18n }}
|
||||||
</a>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
Loading…
Reference in New Issue
Block a user