1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[PM-12743] a11y changes to make new drop down list for send and vault accessible (#11717)

* updating new menus to allow tab + enter to submit the link/button

* Updating New actions to use button instead of a for accessibiity purposes

* refactor

* refactor

* test fix

* fixes

* fixing tests

* fixing test

* fixing tests

---------

Co-authored-by: --global <>
This commit is contained in:
cd-bitwarden
2024-12-02 11:30:38 -05:00
committed by GitHub
parent 456c516a6e
commit 0ff48aa345
5 changed files with 163 additions and 121 deletions

View File

@@ -3,11 +3,19 @@
{{ (hideIcon ? "createSend" : "new") | i18n }}
</button>
<bit-menu #itemOptions>
<a type="button" bitMenuItem (click)="newItemNavigate(sendType.Text)">
<a
bitMenuItem
[routerLink]="buildRouterLink(sendType.File)"
[queryParams]="buildQueryParams(sendType.Text)"
>
<i class="bwi bwi-file-text" slot="start" aria-hidden="true"></i>
{{ "sendTypeText" | i18n }}
</a>
<a type="button" bitMenuItem (click)="newItemNavigate(sendType.File)">
<a
bitMenuItem
[routerLink]="buildRouterLink(sendType.File)"
[queryParams]="buildQueryParams(sendType.File)"
>
<i class="bwi bwi-file" slot="start" aria-hidden="true"></i>
{{ "sendTypeFile" | i18n }}
<button type="button" slot="end" *ngIf="hasNoPremium" bitBadge variant="success">

View File

@@ -32,10 +32,18 @@ export class NewSendDropdownComponent implements OnInit {
));
}
newItemNavigate(type: SendType) {
buildRouterLink(type: SendType) {
if (this.hasNoPremium && type === SendType.File) {
return this.router.navigate(["/premium"]);
return "/premium";
} else {
return "/add-send";
}
void this.router.navigate(["/add-send"], { queryParams: { type: type, isNew: true } });
}
buildQueryParams(type: SendType) {
if (this.hasNoPremium && type === SendType.File) {
return null;
}
return { type: type, isNew: true };
}
}