1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 23:33:31 +00: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

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 confirmed = await Swal.fire({
heightAuto: false,
@@ -210,6 +215,10 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
confirmButtonText: confirmText == null ? this.i18nService.t('ok') : confirmText,
});
if (bootstrapModal != null) {
bootstrapModal.setAttribute('tabindex', '-1');
}
return confirmed.value;
}