1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

update autofill a11y

This commit is contained in:
jaasen-livefront
2025-03-11 14:08:48 -07:00
parent 3c27bdc566
commit 1a3aa0d0f0
5 changed files with 28 additions and 18 deletions

View File

@@ -4292,22 +4292,30 @@
} }
}, },
"viewItemTitle": { "viewItemTitle": {
"message": "View item - $ITEMNAME$", "message": "View item - $ITEMNAME$ - $FIELD$",
"description": "Title for a link that opens a view for an item.", "description": "Title for a link that opens a view for an item.",
"placeholders": { "placeholders": {
"itemname": { "itemname": {
"content": "$1", "content": "$1",
"example": "Secret Item" "example": "Secret Item"
},
"field": {
"content": "$2",
"example": "Username"
} }
} }
}, },
"autofillTitle": { "autofillTitle": {
"message": "Autofill - $ITEMNAME$", "message": "Autofill - $ITEMNAME$ - $FIELD$",
"description": "Title for a button that autofills a login item.", "description": "Title for a button that autofills a login item.",
"placeholders": { "placeholders": {
"itemname": { "itemname": {
"content": "$1", "content": "$1",
"example": "Secret Item" "example": "Secret Item"
},
"field": {
"content": "$2",
"example": "Username"
} }
} }
}, },

View File

@@ -6,6 +6,6 @@
(onRefresh)="refreshCurrentTab()" (onRefresh)="refreshCurrentTab()"
[description]="(showEmptyAutofillTip$ | async) ? ('autofillSuggestionsTip' | i18n) : null" [description]="(showEmptyAutofillTip$ | async) ? ('autofillSuggestionsTip' | i18n) : null"
showAutofillButton showAutofillButton
[primaryActionAutofill]="clickItemsToAutofillVaultView" [primaryActionAutofill]="clickItemsToAutofillVaultView$ | async"
[groupByType]="groupByType()" [groupByType]="groupByType()"
></app-vault-list-items-container> ></app-vault-list-items-container>

View File

@@ -1,7 +1,7 @@
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component, OnInit } from "@angular/core"; import { Component } from "@angular/core";
import { toSignal } from "@angular/core/rxjs-interop"; import { toSignal } from "@angular/core/rxjs-interop";
import { combineLatest, firstValueFrom, map, Observable } from "rxjs"; import { combineLatest, map, Observable } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module"; import { JslibModule } from "@bitwarden/angular/jslib.module";
import { VaultSettingsService } from "@bitwarden/common/vault/abstractions/vault-settings/vault-settings.service"; import { VaultSettingsService } from "@bitwarden/common/vault/abstractions/vault-settings/vault-settings.service";
@@ -33,7 +33,7 @@ import { VaultListItemsContainerComponent } from "../vault-list-items-container/
selector: "app-autofill-vault-list-items", selector: "app-autofill-vault-list-items",
templateUrl: "autofill-vault-list-items.component.html", templateUrl: "autofill-vault-list-items.component.html",
}) })
export class AutofillVaultListItemsComponent implements OnInit { export class AutofillVaultListItemsComponent {
/** /**
* The list of ciphers that can be used to autofill the current page. * The list of ciphers that can be used to autofill the current page.
* @protected * @protected
@@ -47,7 +47,9 @@ export class AutofillVaultListItemsComponent implements OnInit {
*/ */
protected showRefresh: boolean = BrowserPopupUtils.inSidebar(window); protected showRefresh: boolean = BrowserPopupUtils.inSidebar(window);
clickItemsToAutofillVaultView = false; /** Flag indicating whether the login item should automatically autofill when clicked */
protected clickItemsToAutofillVaultView$: Observable<boolean> =
this.vaultSettingsService.clickItemsToAutofillVaultView$;
protected groupByType = toSignal( protected groupByType = toSignal(
this.vaultPopupItemsService.hasFilterApplied$.pipe(map((hasFilter) => !hasFilter)), this.vaultPopupItemsService.hasFilterApplied$.pipe(map((hasFilter) => !hasFilter)),
@@ -84,12 +86,6 @@ export class AutofillVaultListItemsComponent implements OnInit {
// TODO: Migrate logic to show Autofill policy toast PM-8144 // TODO: Migrate logic to show Autofill policy toast PM-8144
} }
async ngOnInit() {
this.clickItemsToAutofillVaultView = await firstValueFrom(
this.vaultSettingsService.clickItemsToAutofillVaultView$,
);
}
/** /**
* Refreshes the current tab to re-populate the autofill ciphers. * Refreshes the current tab to re-populate the autofill ciphers.
* @protected * @protected

View File

@@ -94,7 +94,7 @@
type="button" type="button"
(click)="primaryActionOnSelect(cipher)" (click)="primaryActionOnSelect(cipher)"
(dblclick)="launchCipher(cipher)" (dblclick)="launchCipher(cipher)"
[appA11yTitle]="cipherItemTitleKey | async | i18n: cipher.name" [appA11yTitle]="cipherItemTitleKey | async | i18n: cipher.name : cipher.login.username"
class="{{ itemHeightClass }}" class="{{ itemHeightClass }}"
> >
<div slot="start" class="tw-justify-start tw-w-7 tw-flex"> <div slot="start" class="tw-justify-start tw-w-7 tw-flex">
@@ -124,8 +124,11 @@
bitBadge bitBadge
variant="primary" variant="primary"
(click)="doAutofill(cipher)" (click)="doAutofill(cipher)"
[title]="autofillShortcutTooltip() ?? ('autofillTitle' | i18n: cipher.name)" [title]="
[attr.aria-label]="'autofillTitle' | i18n: cipher.name" autofillShortcutTooltip() ??
('autofillTitle' | i18n: cipher.name : cipher.login.username)
"
[attr.aria-label]="'autofillTitle' | i18n: cipher.name : cipher.login.username"
> >
{{ "fill" | i18n }} {{ "fill" | i18n }}
</button> </button>

View File

@@ -1,4 +1,4 @@
import { Observable, map } from "rxjs"; import { Observable, map, shareReplay } from "rxjs";
import { ActiveUserState, GlobalState, StateProvider } from "../../../platform/state"; import { ActiveUserState, GlobalState, StateProvider } from "../../../platform/state";
import { VaultSettingsService as VaultSettingsServiceAbstraction } from "../../abstractions/vault-settings/vault-settings.service"; import { VaultSettingsService as VaultSettingsServiceAbstraction } from "../../abstractions/vault-settings/vault-settings.service";
@@ -46,7 +46,10 @@ export class VaultSettingsService implements VaultSettingsServiceAbstraction {
* {@link VaultSettingsServiceAbstraction.clickItemsToAutofillVaultView$$} * {@link VaultSettingsServiceAbstraction.clickItemsToAutofillVaultView$$}
*/ */
readonly clickItemsToAutofillVaultView$: Observable<boolean> = readonly clickItemsToAutofillVaultView$: Observable<boolean> =
this.clickItemsToAutofillVaultViewState.state$.pipe(map((x) => x ?? false)); this.clickItemsToAutofillVaultViewState.state$.pipe(
map((x) => x ?? false),
shareReplay({ bufferSize: 1, refCount: false }),
);
constructor(private stateProvider: StateProvider) {} constructor(private stateProvider: StateProvider) {}