make dialogs focusable
Makes dialogs focusable, makes it possible
to use dialog headers as modal labels, and
automaticlly set focus when a dialog is displayed.
@@ -76,6 +76,15 @@ DialogSystem.showDialog = function(elmt, onCancel) {
DialogSystem.setupEscapeKeyHandling();
+ elmt.attr("aria-role", "dialog");
+ var dialogHeader = elmt.find(".dialog-header");
+ if (dialogHeader.length && dialogHeader[0].id) {
+ elmt.attr("aria-labeledby", dialogHeader[0].id);
+ }
+
+ elmt.attr("tabindex", -1);
+ elmt.focus();
+
return level;
};
