@nysds/components 1.4.5 → 1.4.6
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/dist/nysds.es.js
CHANGED
|
@@ -6290,7 +6290,7 @@ const D1 = class D1 extends u {
|
|
|
6290
6290
|
updated(e) {
|
|
6291
6291
|
super.updated(e);
|
|
6292
6292
|
const t = this._firstAssignedEl;
|
|
6293
|
-
t && e.has("text") && this.
|
|
6293
|
+
t && e.has("text") && this._passAria(t);
|
|
6294
6294
|
}
|
|
6295
6295
|
// Listen to window scroll so a focus tooltip can auto position even when user move across the page
|
|
6296
6296
|
_addScrollListeners() {
|
|
@@ -6300,9 +6300,15 @@ const D1 = class D1 extends u {
|
|
|
6300
6300
|
window.removeEventListener("scroll", this._handleScrollOrResize, !0), window.removeEventListener("resize", this._handleScrollOrResize);
|
|
6301
6301
|
}
|
|
6302
6302
|
/******************** Functions ********************/
|
|
6303
|
-
// We need to pass `ariaDescription` to the nys-components so they can announce both their label and the tooltip's text
|
|
6304
|
-
|
|
6305
|
-
e.tagName.toLowerCase()
|
|
6303
|
+
// We need to pass `ariaLabel` or `ariaDescription` to the nys-components so they can announce both their label and the tooltip's text
|
|
6304
|
+
_passAria(e) {
|
|
6305
|
+
const t = e.tagName.toLowerCase();
|
|
6306
|
+
if (t.startsWith("nys-"))
|
|
6307
|
+
if (t === "nys-icon") {
|
|
6308
|
+
const o = e.getAttribute("ariaLabel") || "", s = o ? `${o}, ${this.text}` : this.text;
|
|
6309
|
+
e.setAttribute("ariaLabel", s);
|
|
6310
|
+
} else
|
|
6311
|
+
e.setAttribute("ariaDescription", this.text);
|
|
6306
6312
|
}
|
|
6307
6313
|
async _applyFocusBehavior(e) {
|
|
6308
6314
|
var o;
|