1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-02 18:17:46 +01:00

[PM-4239] When viewing an item with a passkey, passkey is not announced by screenreader (#7154)

* Made passkey field focusable

* Made passkey field focusableand accessibilty possible for screenreaders in announcing the field
This commit is contained in:
SmithThe4th 2023-12-21 10:54:54 -05:00 committed by GitHub
parent 6fe82e95e7
commit 07d224d6bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 66 additions and 22 deletions

View File

@ -131,7 +131,12 @@
</div> </div>
<!--Passkey--> <!--Passkey-->
<div class="box" *ngIf="cipher.login.hasFido2Credentials && !cloneMode"> <div
class="box"
*ngIf="cipher.login.hasFido2Credentials && !cloneMode"
tabindex="0"
attr.aria-label="{{ 'typePasskey' | i18n }} {{ fido2CredentialCreationDateValue }}"
>
<div class="box-content"> <div class="box-content">
<div class="box-content-row text-muted"> <div class="box-content-row text-muted">
<span class="row-label">{{ "typePasskey" | i18n }}</span> <span class="row-label">{{ "typePasskey" | i18n }}</span>

View File

@ -1,4 +1,4 @@
import { Location } from "@angular/common"; import { DatePipe, Location } from "@angular/common";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { firstValueFrom } from "rxjs"; import { firstValueFrom } from "rxjs";
@ -66,6 +66,7 @@ export class AddEditComponent extends BaseAddEditComponent {
logService: LogService, logService: LogService,
sendApiService: SendApiService, sendApiService: SendApiService,
dialogService: DialogService, dialogService: DialogService,
datePipe: DatePipe,
) { ) {
super( super(
cipherService, cipherService,
@ -83,6 +84,7 @@ export class AddEditComponent extends BaseAddEditComponent {
organizationService, organizationService,
sendApiService, sendApiService,
dialogService, dialogService,
datePipe,
); );
} }

View File

@ -144,12 +144,16 @@
</div> </div>
<!--Passkey--> <!--Passkey-->
<div class="box" *ngIf="cipher.login.hasFido2Credentials"> <div
class="box"
*ngIf="cipher.login.hasFido2Credentials"
tabindex="0"
attr.aria-label="{{ 'typePasskey' | i18n }} {{ fido2CredentialCreationDateValue }}"
>
<div class="box-content"> <div class="box-content">
<div class="box-content-row text-muted"> <div class="box-content-row text-muted">
<span class="row-label">{{ "typePasskey" | i18n }}</span> <span class="row-label">{{ "typePasskey" | i18n }}</span>
{{ "dateCreated" | i18n }} {{ fido2CredentialCreationDateValue }}
{{ cipher.login.fido2Credentials[0].creationDate | date: "short" }}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Location } from "@angular/common"; import { DatePipe, Location } from "@angular/common";
import { ChangeDetectorRef, Component, NgZone } from "@angular/core"; import { ChangeDetectorRef, Component, NgZone } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { Subject, firstValueFrom, takeUntil } from "rxjs"; import { Subject, firstValueFrom, takeUntil } from "rxjs";
@ -96,6 +96,7 @@ export class ViewComponent extends BaseViewComponent {
logService: LogService, logService: LogService,
fileDownloadService: FileDownloadService, fileDownloadService: FileDownloadService,
dialogService: DialogService, dialogService: DialogService,
datePipe: DatePipe,
) { ) {
super( super(
cipherService, cipherService,
@ -117,6 +118,7 @@ export class ViewComponent extends BaseViewComponent {
stateService, stateService,
fileDownloadService, fileDownloadService,
dialogService, dialogService,
datePipe,
); );
} }

View File

@ -119,10 +119,11 @@
class="box-content-row text-muted" class="box-content-row text-muted"
*ngIf="cipher.login.hasFido2Credentials && !cloneMode" *ngIf="cipher.login.hasFido2Credentials && !cloneMode"
appBoxRow appBoxRow
tabindex="0"
attr.aria-label="{{ 'typePasskey' | i18n }} {{ fido2CredentialCreationDateValue }}"
> >
<span class="row-label">{{ "typePasskey" | i18n }}</span> <span class="row-label">{{ "typePasskey" | i18n }}</span>
{{ "dateCreated" | i18n }} {{ fido2CredentialCreationDateValue }}
{{ cipher.login.fido2Credentials[0].creationDate | date: "short" }}
</div> </div>
<div class="box-content-row" appBoxRow> <div class="box-content-row" appBoxRow>

View File

@ -1,3 +1,4 @@
import { DatePipe } from "@angular/common";
import { Component, NgZone, OnChanges, OnDestroy, ViewChild } from "@angular/core"; import { Component, NgZone, OnChanges, OnDestroy, ViewChild } from "@angular/core";
import { NgForm } from "@angular/forms"; import { NgForm } from "@angular/forms";
@ -46,6 +47,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges,
organizationService: OrganizationService, organizationService: OrganizationService,
sendApiService: SendApiService, sendApiService: SendApiService,
dialogService: DialogService, dialogService: DialogService,
datePipe: DatePipe,
) { ) {
super( super(
cipherService, cipherService,
@ -63,6 +65,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges,
organizationService, organizationService,
sendApiService, sendApiService,
dialogService, dialogService,
datePipe,
); );
} }

View File

@ -119,10 +119,14 @@
</div> </div>
</div> </div>
<!--Passkey--> <!--Passkey-->
<div class="box-content-row text-muted" *ngIf="cipher.login.hasFido2Credentials"> <div
class="box-content-row text-muted"
*ngIf="cipher.login.hasFido2Credentials"
tabindex="0"
attr.aria-label="{{ 'typePasskey' | i18n }} {{ fido2CredentialCreationDateValue }}"
>
<span class="row-label">{{ "typePasskey" | i18n }}</span> <span class="row-label">{{ "typePasskey" | i18n }}</span>
{{ "dateCreated" | i18n }} {{ fido2CredentialCreationDateValue }}
{{ cipher.login.fido2Credentials[0].creationDate | date: "short" }}
</div> </div>
<div <div
class="box-content-row box-content-row-flex totp" class="box-content-row box-content-row-flex totp"

View File

@ -1,3 +1,4 @@
import { DatePipe } from "@angular/common";
import { import {
ChangeDetectorRef, ChangeDetectorRef,
Component, Component,
@ -56,6 +57,7 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
stateService: StateService, stateService: StateService,
fileDownloadService: FileDownloadService, fileDownloadService: FileDownloadService,
dialogService: DialogService, dialogService: DialogService,
datePipe: DatePipe,
) { ) {
super( super(
cipherService, cipherService,
@ -77,6 +79,7 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
stateService, stateService,
fileDownloadService, fileDownloadService,
dialogService, dialogService,
datePipe,
); );
} }
ngOnInit() { ngOnInit() {

View File

@ -195,7 +195,13 @@
<div class="row"> <div class="row">
<div class="col-6 form-group"> <div class="col-6 form-group">
<label for="loginFido2credential">{{ "typePasskey" | i18n }}</label> <label for="loginFido2credential">{{ "typePasskey" | i18n }}</label>
<div class="input-group"> <div
class="input-group"
tabindex="0"
attr.aria-label="{{ 'typePasskey' | i18n }} {{
fido2CredentialCreationDateValue
}}"
>
<input <input
id="loginFido2credential" id="loginFido2credential"
class="form-control" class="form-control"

View File

@ -43,15 +43,6 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
protected totpInterval: number; protected totpInterval: number;
protected override componentName = "app-vault-add-edit"; protected override componentName = "app-vault-add-edit";
get fido2CredentialCreationDateValue(): string {
const dateCreated = this.i18nService.t("dateCreated");
const creationDate = this.datePipe.transform(
this.cipher?.login?.fido2Credentials?.[0]?.creationDate,
"short",
);
return `${dateCreated} ${creationDate}`;
}
constructor( constructor(
cipherService: CipherService, cipherService: CipherService,
folderService: FolderService, folderService: FolderService,
@ -70,7 +61,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
passwordRepromptService: PasswordRepromptService, passwordRepromptService: PasswordRepromptService,
sendApiService: SendApiService, sendApiService: SendApiService,
dialogService: DialogService, dialogService: DialogService,
private datePipe: DatePipe, datePipe: DatePipe,
) { ) {
super( super(
cipherService, cipherService,
@ -88,6 +79,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
organizationService, organizationService,
sendApiService, sendApiService,
dialogService, dialogService,
datePipe,
); );
} }

View File

@ -1,3 +1,4 @@
import { DatePipe } from "@angular/common";
import { Directive, EventEmitter, Input, OnDestroy, OnInit, Output } from "@angular/core"; import { Directive, EventEmitter, Input, OnDestroy, OnInit, Output } from "@angular/core";
import { Observable, Subject, takeUntil, concatMap } from "rxjs"; import { Observable, Subject, takeUntil, concatMap } from "rxjs";
@ -85,6 +86,15 @@ export class AddEditComponent implements OnInit, OnDestroy {
private personalOwnershipPolicyAppliesToActiveUser: boolean; private personalOwnershipPolicyAppliesToActiveUser: boolean;
private previousCipherId: string; private previousCipherId: string;
get fido2CredentialCreationDateValue(): string {
const dateCreated = this.i18nService.t("dateCreated");
const creationDate = this.datePipe.transform(
this.cipher?.login?.fido2Credentials?.[0]?.creationDate,
"short",
);
return `${dateCreated} ${creationDate}`;
}
constructor( constructor(
protected cipherService: CipherService, protected cipherService: CipherService,
protected folderService: FolderService, protected folderService: FolderService,
@ -101,6 +111,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
private organizationService: OrganizationService, private organizationService: OrganizationService,
protected sendApiService: SendApiService, protected sendApiService: SendApiService,
protected dialogService: DialogService, protected dialogService: DialogService,
protected datePipe: DatePipe,
) { ) {
this.typeOptions = [ this.typeOptions = [
{ name: i18nService.t("typeLogin"), value: CipherType.Login }, { name: i18nService.t("typeLogin"), value: CipherType.Login },

View File

@ -1,3 +1,4 @@
import { DatePipe } from "@angular/common";
import { import {
ChangeDetectorRef, ChangeDetectorRef,
Directive, Directive,
@ -68,6 +69,15 @@ export class ViewComponent implements OnDestroy, OnInit {
private previousCipherId: string; private previousCipherId: string;
private passwordReprompted = false; private passwordReprompted = false;
get fido2CredentialCreationDateValue(): string {
const dateCreated = this.i18nService.t("dateCreated");
const creationDate = this.datePipe.transform(
this.cipher?.login?.fido2Credentials?.[0]?.creationDate,
"short",
);
return `${dateCreated} ${creationDate}`;
}
constructor( constructor(
protected cipherService: CipherService, protected cipherService: CipherService,
protected folderService: FolderService, protected folderService: FolderService,
@ -88,6 +98,7 @@ export class ViewComponent implements OnDestroy, OnInit {
protected stateService: StateService, protected stateService: StateService,
protected fileDownloadService: FileDownloadService, protected fileDownloadService: FileDownloadService,
protected dialogService: DialogService, protected dialogService: DialogService,
protected datePipe: DatePipe,
) {} ) {}
ngOnInit() { ngOnInit() {