1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-28 17:27:50 +01:00

Fix accessibility (a11y) on swal2 modals (#986)

* Remove tabindex on bootstrap modals if swal open

* fix linting
This commit is contained in:
Thomas Rittson 2021-05-21 06:52:44 +10:00 committed by GitHub
parent 35346613d8
commit e34e4728d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -195,6 +195,11 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
} }
} }
const bootstrapModal = document.querySelector('div.modal');
if (bootstrapModal != null) {
bootstrapModal.removeAttribute('tabindex');
}
const iconHtmlStr = iconClasses != null ? `<i class="swal-custom-icon fa ${iconClasses}"></i>` : undefined; const iconHtmlStr = iconClasses != null ? `<i class="swal-custom-icon fa ${iconClasses}"></i>` : undefined;
const confirmed = await Swal.fire({ const confirmed = await Swal.fire({
heightAuto: false, heightAuto: false,
@ -210,6 +215,10 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
confirmButtonText: confirmText == null ? this.i18nService.t('ok') : confirmText, confirmButtonText: confirmText == null ? this.i18nService.t('ok') : confirmText,
}); });
if (bootstrapModal != null) {
bootstrapModal.setAttribute('tabindex', '-1');
}
return confirmed.value; return confirmed.value;
} }