@qooxdoo/framework 7.0.0-beta.4 → 7.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -3827,6 +3827,76 @@ qx.Class.define("qx.ui.core.Widget",
|
|
|
3827
3827
|
|
|
3828
3828
|
|
|
3829
3829
|
|
|
3830
|
+
/*
|
|
3831
|
+
---------------------------------------------------------------------------
|
|
3832
|
+
ARIA attrs support
|
|
3833
|
+
---------------------------------------------------------------------------
|
|
3834
|
+
*/
|
|
3835
|
+
|
|
3836
|
+
/**
|
|
3837
|
+
* Sets the string which labels this widget. This will be read out by screenreaders. Needed if there is no
|
|
3838
|
+
* readable text/label in this widget which would automatically act as aria-label.
|
|
3839
|
+
* @param label {String} Labelling Text
|
|
3840
|
+
*/
|
|
3841
|
+
setAriaLabel: function(label) {
|
|
3842
|
+
this.getContentElement().setAttribute("aria-label", label);
|
|
3843
|
+
},
|
|
3844
|
+
|
|
3845
|
+
/**
|
|
3846
|
+
* Marks that this widget gets labelled by another widget. This will be read out by screenreaders as first
|
|
3847
|
+
* information.
|
|
3848
|
+
* Similiar to aria-label, difference being that the labelling widget is an different widget and multiple
|
|
3849
|
+
* widgets can be added.
|
|
3850
|
+
* @param labelWidgets {qx.ui.core.Widget[]} Indefinite Number of labelling Widgets
|
|
3851
|
+
*/
|
|
3852
|
+
addAriaLabelledBy: function(...labelWidgets) {
|
|
3853
|
+
this.__addAriaXBy(labelWidgets, "aria-labelledby");
|
|
3854
|
+
},
|
|
3855
|
+
|
|
3856
|
+
/**
|
|
3857
|
+
* Marks that this widget gets described by another widget. This will be read out by screenreaders as last
|
|
3858
|
+
* information. Multiple Widgets possible.
|
|
3859
|
+
* @param describingWidgets {qx.ui.core.Widget[]} Indefinite Number of describing Widgets
|
|
3860
|
+
*/
|
|
3861
|
+
addAriaDescribedBy: function(...describingWidgets) {
|
|
3862
|
+
this.__addAriaXBy(describingWidgets, "aria-describedby");
|
|
3863
|
+
},
|
|
3864
|
+
|
|
3865
|
+
/**
|
|
3866
|
+
* Sets either aria-labelledby or aria-describedby
|
|
3867
|
+
* @param widgets {qx.ui.core.Widget[]} Indefinite Number of widgets
|
|
3868
|
+
* @param ariaAttr {String} aria-labelledby | aria-describedby
|
|
3869
|
+
*/
|
|
3870
|
+
__addAriaXBy: function(widgets, ariaAttr) {
|
|
3871
|
+
if (!["aria-labelledby", "aria-describedby"].includes(ariaAttr)) {
|
|
3872
|
+
throw new Error("Only aria-labelledby or aria-describedby allowed!");
|
|
3873
|
+
}
|
|
3874
|
+
let idArr = [];
|
|
3875
|
+
for (const widget of widgets) {
|
|
3876
|
+
if (!(widget instanceof qx.ui.core.Widget)) {
|
|
3877
|
+
throw new Error("Given widget " + widget + " is not an instance of qx.ui.core.Widget!");
|
|
3878
|
+
}
|
|
3879
|
+
const contentEl = widget.getContentElement();
|
|
3880
|
+
let widgetId = contentEl.getAttribute("id");
|
|
3881
|
+
if (!widgetId) {
|
|
3882
|
+
widgetId = `label-${widget.toHashCode()}`;
|
|
3883
|
+
contentEl.setAttribute("id", widgetId);
|
|
3884
|
+
}
|
|
3885
|
+
if (!idArr.includes(widgetId)) {
|
|
3886
|
+
idArr.push(widgetId);
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
if (idArr.length === 0) {
|
|
3890
|
+
return;
|
|
3891
|
+
}
|
|
3892
|
+
const idStr = idArr.join(" ");
|
|
3893
|
+
const contentEl = this.getContentElement();
|
|
3894
|
+
let res = contentEl.getAttribute(ariaAttr);
|
|
3895
|
+
res = res ? `${res} ${idStr}` : idStr;
|
|
3896
|
+
contentEl.setAttribute(ariaAttr, res);
|
|
3897
|
+
},
|
|
3898
|
+
|
|
3899
|
+
|
|
3830
3900
|
|
|
3831
3901
|
/*
|
|
3832
3902
|
---------------------------------------------------------------------------
|
|
@@ -602,7 +602,22 @@ qx.Class.define("qx.ui.form.DateField",
|
|
|
602
602
|
|
|
603
603
|
field.getFocusElement().focus();
|
|
604
604
|
field.selectAllText();
|
|
605
|
-
}
|
|
605
|
+
},
|
|
606
|
+
|
|
607
|
+
// overridden
|
|
608
|
+
setAriaLabel: function(label) {
|
|
609
|
+
this.getChildControl("textfield").setAriaLabel(label);
|
|
610
|
+
},
|
|
611
|
+
|
|
612
|
+
// overridden
|
|
613
|
+
addAriaLabelledBy: function(...labelWidgets) {
|
|
614
|
+
this.getChildControl("textfield").addAriaLabelledBy(...labelWidgets);
|
|
615
|
+
},
|
|
616
|
+
|
|
617
|
+
// overridden
|
|
618
|
+
addAriaDescribedBy: function(...describingWidgets) {
|
|
619
|
+
this.getChildControl("textfield").addAriaDescribedBy(...describingWidgets);
|
|
620
|
+
},
|
|
606
621
|
},
|
|
607
622
|
|
|
608
623
|
|
|
@@ -102,6 +102,11 @@ qx.Class.define("qx.ui.window.Window",
|
|
|
102
102
|
|
|
103
103
|
// Change the resize frames appearance
|
|
104
104
|
this._getResizeFrame().setAppearance("window-resize-frame");
|
|
105
|
+
|
|
106
|
+
// ARIA attrs
|
|
107
|
+
this.getContentElement().setAttribute("role", "dialog");
|
|
108
|
+
this.addAriaLabelledBy(this.getChildControl("title"));
|
|
109
|
+
this.addAriaDescribedBy(this.getChildControl("statusbar-text"));
|
|
105
110
|
},
|
|
106
111
|
|
|
107
112
|
|
|
@@ -961,6 +966,9 @@ qx.Class.define("qx.ui.window.Window",
|
|
|
961
966
|
} else {
|
|
962
967
|
this.addState("modal");
|
|
963
968
|
}
|
|
969
|
+
|
|
970
|
+
// ARIA attrs
|
|
971
|
+
this.getContentElement().setAttribute("aria-modal", value);
|
|
964
972
|
},
|
|
965
973
|
|
|
966
974
|
|