Fix accessibility (a11y) on swal2 modals (#986)
* Remove tabindex on bootstrap modals if swal open * fix linting
This commit is contained in:
parent
35346613d8
commit
e34e4728d0
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue