make dialog content accessible

screen readers announce alert dialogs
This commit is contained in:
daria 2025-05-21 12:09:53 -07:00
parent de453ad03d
commit 482a8b17d9
No known key found for this signature in database
GPG Key ID: 78018F06E7C6A3CF
3 changed files with 9 additions and 3 deletions

View File

@ -324,7 +324,7 @@
min-width: 88px;
}
nav {
nav, section {
padding: @alertify_padding-base;
text-align: right;
button, div.cp-button-confirm {

View File

@ -66,7 +66,7 @@
display: none;
}
nav {
nav, section {
display: flex;
justify-content: flex-end;
align-items: flex-end;

View File

@ -196,7 +196,7 @@ define([
};
dialog.nav = function (content) {
return h('nav', content || [
return h('section', content || [
dialog.cancelButton(),
dialog.okButton(),
]);
@ -212,6 +212,12 @@ define([
h('div'+cls, content),
])
]);
var dialogContent = frame.querySelector('div' + cls);
dialogContent.setAttribute('aria-live', 'assertive');
dialogContent.setAttribute('role', 'alertdialog');
dialogContent.setAttribute('aria-modal', 'true');
var $frame = $(frame);
frame.closeModal = function (cb) {
frame.closeModal = function () {}; // Prevent further calls