1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

[PS-1017] corrected web vault accessibility when deleting an item with keyboard (#3893)

* PS-1017 Sending parent property to swal when delete popup appears above a modal

* PS-1017 - Added more cases where the parent is necessary to swal react properly to keyboard inputs.
Changed the way the ".modal-content" class is added to target to have it only on one place.

* [PS-1017] Removed edit of target css selector from platform. Added full target on related component
This commit is contained in:
aj-rosado 2022-12-14 14:59:13 +00:00 committed by GitHub
parent ac2f171e2c
commit 836d87f492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 40 additions and 10 deletions

View File

@ -140,7 +140,8 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
confirmText?: string, confirmText?: string,
cancelText?: string, cancelText?: string,
type?: string, type?: string,
bodyIsHtml = false bodyIsHtml = false,
target?: string
) { ) {
let iconClasses: string = null; let iconClasses: string = null;
if (type != null) { if (type != null) {
@ -182,6 +183,7 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
cancelButtonText: cancelText, cancelButtonText: cancelText,
showConfirmButton: true, showConfirmButton: true,
confirmButtonText: confirmText == null ? this.i18nService.t("ok") : confirmText, confirmButtonText: confirmText == null ? this.i18nService.t("ok") : confirmText,
target: target != null ? target : "body",
}); });
if (bootstrapModal != null) { if (bootstrapModal != null) {

View File

@ -158,7 +158,9 @@ export class CollectionAddEditComponent implements OnInit {
this.name, this.name,
this.i18nService.t("yes"), this.i18nService.t("yes"),
this.i18nService.t("no"), this.i18nService.t("no"),
"warning" "warning",
false,
"app-collection-add-edit .modal-content"
); );
if (!confirmed) { if (!confirmed) {
return false; return false;

View File

@ -130,7 +130,9 @@ export class GroupAddEditComponent implements OnInit {
this.name, this.name,
this.i18nService.t("yes"), this.i18nService.t("yes"),
this.i18nService.t("no"), this.i18nService.t("no"),
"warning" "warning",
false,
"app-group-add-edit .modal-content"
); );
if (!confirmed) { if (!confirmed) {
return false; return false;

View File

@ -215,7 +215,9 @@ export class UserAddEditComponent implements OnInit {
this.i18nService.t("removeUserIdAccess", this.name), this.i18nService.t("removeUserIdAccess", this.name),
this.i18nService.t("yes"), this.i18nService.t("yes"),
this.i18nService.t("no"), this.i18nService.t("no"),
"warning" "warning",
false,
"app-user-add-edit .modal-content"
); );
if (!confirmed) { if (!confirmed) {
return false; return false;
@ -248,7 +250,9 @@ export class UserAddEditComponent implements OnInit {
this.i18nService.t("revokeUserId", this.name), this.i18nService.t("revokeUserId", this.name),
this.i18nService.t("revokeAccess"), this.i18nService.t("revokeAccess"),
this.i18nService.t("cancel"), this.i18nService.t("cancel"),
"warning" "warning",
false,
"app-user-add-edit .modal-content"
); );
if (!confirmed) { if (!confirmed) {
return false; return false;

View File

@ -29,6 +29,7 @@ import { AddEditComponent as BaseAddEditComponent } from "../../vault/add-edit.c
}) })
export class AddEditComponent extends BaseAddEditComponent { export class AddEditComponent extends BaseAddEditComponent {
originalCipher: Cipher = null; originalCipher: Cipher = null;
protected override componentName = "app-org-vault-add-edit";
constructor( constructor(
cipherService: CipherService, cipherService: CipherService,

View File

@ -16,6 +16,8 @@ import { StateService } from "@bitwarden/common/abstractions/state.service";
templateUrl: "add-edit.component.html", templateUrl: "add-edit.component.html",
}) })
export class AddEditComponent extends BaseAddEditComponent { export class AddEditComponent extends BaseAddEditComponent {
override componentName = "app-send-add-edit";
constructor( constructor(
i18nService: I18nService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, platformUtilsService: PlatformUtilsService,

View File

@ -26,6 +26,7 @@ import { AddEditComponent as BaseAddEditComponent } from "../vault/add-edit.comp
export class EmergencyAddEditComponent extends BaseAddEditComponent { export class EmergencyAddEditComponent extends BaseAddEditComponent {
originalCipher: Cipher = null; originalCipher: Cipher = null;
viewOnly = true; viewOnly = true;
protected override componentName = "app-org-vault-add-edit";
constructor( constructor(
cipherService: CipherService, cipherService: CipherService,

View File

@ -37,6 +37,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
viewOnly = false; viewOnly = false;
protected totpInterval: number; protected totpInterval: number;
protected override componentName = "app-vault-add-edit";
constructor( constructor(
cipherService: CipherService, cipherService: CipherService,

View File

@ -17,6 +17,7 @@ import { AttachmentView } from "@bitwarden/common/models/view/attachment.view";
}) })
export class AttachmentsComponent extends BaseAttachmentsComponent { export class AttachmentsComponent extends BaseAttachmentsComponent {
viewOnly = false; viewOnly = false;
protected override componentName = "app-vault-attachments";
constructor( constructor(
cipherService: CipherService, cipherService: CipherService,

View File

@ -12,6 +12,7 @@ import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUti
templateUrl: "folder-add-edit.component.html", templateUrl: "folder-add-edit.component.html",
}) })
export class FolderAddEditComponent extends BaseFolderAddEditComponent { export class FolderAddEditComponent extends BaseFolderAddEditComponent {
protected override componentName = "app-folder-add-edit";
constructor( constructor(
folderService: FolderService, folderService: FolderService,
folderApiService: FolderApiServiceAbstraction, folderApiService: FolderApiServiceAbstraction,

View File

@ -77,6 +77,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
canUseReprompt = true; canUseReprompt = true;
organization: Organization; organization: Organization;
protected componentName = "";
protected destroy$ = new Subject<void>(); protected destroy$ = new Subject<void>();
protected writeableCollections: CollectionView[]; protected writeableCollections: CollectionView[];
private personalOwnershipPolicyAppliesToActiveUser: boolean; private personalOwnershipPolicyAppliesToActiveUser: boolean;
@ -397,7 +398,9 @@ export class AddEditComponent implements OnInit, OnDestroy {
this.i18nService.t("deleteItem"), this.i18nService.t("deleteItem"),
this.i18nService.t("yes"), this.i18nService.t("yes"),
this.i18nService.t("no"), this.i18nService.t("no"),
"warning" "warning",
false,
this.componentName != "" ? this.componentName + " .modal-content" : null
); );
if (!confirmed) { if (!confirmed) {
return false; return false;

View File

@ -29,6 +29,7 @@ export class AttachmentsComponent implements OnInit {
deletePromises: { [id: string]: Promise<any> } = {}; deletePromises: { [id: string]: Promise<any> } = {};
reuploadPromises: { [id: string]: Promise<any> } = {}; reuploadPromises: { [id: string]: Promise<any> } = {};
emergencyAccessId?: string = null; emergencyAccessId?: string = null;
protected componentName = "";
constructor( constructor(
protected cipherService: CipherService, protected cipherService: CipherService,
@ -104,7 +105,9 @@ export class AttachmentsComponent implements OnInit {
this.i18nService.t("deleteAttachment"), this.i18nService.t("deleteAttachment"),
this.i18nService.t("yes"), this.i18nService.t("yes"),
this.i18nService.t("no"), this.i18nService.t("no"),
"warning" "warning",
false,
this.componentName != "" ? this.componentName + " .modal-content" : null
); );
if (!confirmed) { if (!confirmed) {
return; return;

View File

@ -18,6 +18,7 @@ export class FolderAddEditComponent implements OnInit {
title: string; title: string;
formPromise: Promise<any>; formPromise: Promise<any>;
deletePromise: Promise<any>; deletePromise: Promise<any>;
protected componentName = "";
constructor( constructor(
protected folderService: FolderService, protected folderService: FolderService,
@ -65,7 +66,9 @@ export class FolderAddEditComponent implements OnInit {
this.i18nService.t("deleteFolder"), this.i18nService.t("deleteFolder"),
this.i18nService.t("yes"), this.i18nService.t("yes"),
this.i18nService.t("no"), this.i18nService.t("no"),
"warning" "warning",
false,
this.componentName != "" ? this.componentName + " .modal-content" : null
); );
if (!confirmed) { if (!confirmed) {
return false; return false;

View File

@ -45,6 +45,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
alertShown = false; alertShown = false;
showOptions = false; showOptions = false;
protected componentName = "";
private sendLinkBaseUrl: string; private sendLinkBaseUrl: string;
private destroy$ = new Subject<void>(); private destroy$ = new Subject<void>();
@ -242,7 +243,9 @@ export class AddEditComponent implements OnInit, OnDestroy {
this.i18nService.t("deleteSend"), this.i18nService.t("deleteSend"),
this.i18nService.t("yes"), this.i18nService.t("yes"),
this.i18nService.t("no"), this.i18nService.t("no"),
"warning" "warning",
false,
this.componentName != "" ? this.componentName + " .modal-content" : null
); );
if (!confirmed) { if (!confirmed) {
return false; return false;

View File

@ -34,7 +34,8 @@ export abstract class PlatformUtilsService {
confirmText?: string, confirmText?: string,
cancelText?: string, cancelText?: string,
type?: string, type?: string,
bodyIsHtml?: boolean bodyIsHtml?: boolean,
target?: string
) => Promise<boolean>; ) => Promise<boolean>;
isDev: () => boolean; isDev: () => boolean;
isSelfHost: () => boolean; isSelfHost: () => boolean;