nsw-design-system 3.18.3 → 3.18.4
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/js/main.js
CHANGED
|
@@ -4219,6 +4219,11 @@
|
|
|
4219
4219
|
ariaExpanded = this.trigger.getAttribute('aria-expanded') === 'true' ? 'false' : 'true';
|
|
4220
4220
|
}
|
|
4221
4221
|
this.trigger.setAttribute('aria-expanded', ariaExpanded);
|
|
4222
|
+
const options = this.dropdown.querySelectorAll(`.js-${this.optionClass}`);
|
|
4223
|
+
options.forEach(option => {
|
|
4224
|
+
const isVisible = ariaExpanded === 'true';
|
|
4225
|
+
option.setAttribute('aria-hidden', !isVisible);
|
|
4226
|
+
});
|
|
4222
4227
|
if (ariaExpanded === 'true') {
|
|
4223
4228
|
const selectedOption = this.getSelectedOption() || this.allButton;
|
|
4224
4229
|
this.constructor.moveFocusFn(selectedOption);
|
|
@@ -4387,7 +4392,8 @@
|
|
|
4387
4392
|
const disabled = options[i].hasAttribute('disabled') ? 'disabled' : '';
|
|
4388
4393
|
const checked = options[i].hasAttribute('selected') ? 'checked' : '';
|
|
4389
4394
|
const uniqueName = this.constructor.createSafeCss(`${this.selectId}-${options[i].value}-${this.optionIndex.toString()}`);
|
|
4390
|
-
|
|
4395
|
+
const ariaHidden = options[i].hasAttribute('hidden') ? 'aria-hidden="true"' : '';
|
|
4396
|
+
list = `${list}<li class="js-${this.optionClass}" role="option" data-value="${options[i].value}" ${selected} ${ariaHidden} data-label="${options[i].text}" data-index="${this.optionIndex}"><input class="${this.prefix}${this.checkboxInputClass} js-${this.checkboxClass}" type="checkbox" id="${uniqueName}" ${checked} ${disabled}><label class="${this.prefix}${this.checkboxLabelClass} ${this.prefix}${this.itemClass} ${this.prefix}${this.itemClass}--option" for="${uniqueName}"><span>${options[i].text}</span></label></li>`;
|
|
4391
4397
|
this.optionIndex += 1;
|
|
4392
4398
|
}
|
|
4393
4399
|
return list;
|
package/package.json
CHANGED
|
@@ -100,6 +100,13 @@ class Select {
|
|
|
100
100
|
ariaExpanded = this.trigger.getAttribute('aria-expanded') === 'true' ? 'false' : 'true'
|
|
101
101
|
}
|
|
102
102
|
this.trigger.setAttribute('aria-expanded', ariaExpanded)
|
|
103
|
+
|
|
104
|
+
const options = this.dropdown.querySelectorAll(`.js-${this.optionClass}`)
|
|
105
|
+
options.forEach((option) => {
|
|
106
|
+
const isVisible = ariaExpanded === 'true'
|
|
107
|
+
option.setAttribute('aria-hidden', !isVisible)
|
|
108
|
+
})
|
|
109
|
+
|
|
103
110
|
if (ariaExpanded === 'true') {
|
|
104
111
|
const selectedOption = this.getSelectedOption() || this.allButton
|
|
105
112
|
this.constructor.moveFocusFn(selectedOption)
|
|
@@ -296,7 +303,8 @@ class Select {
|
|
|
296
303
|
const disabled = options[i].hasAttribute('disabled') ? 'disabled' : ''
|
|
297
304
|
const checked = options[i].hasAttribute('selected') ? 'checked' : ''
|
|
298
305
|
const uniqueName = this.constructor.createSafeCss(`${this.selectId}-${options[i].value}-${this.optionIndex.toString()}`)
|
|
299
|
-
|
|
306
|
+
const ariaHidden = options[i].hasAttribute('hidden') ? 'aria-hidden="true"' : ''
|
|
307
|
+
list = `${list}<li class="js-${this.optionClass}" role="option" data-value="${options[i].value}" ${selected} ${ariaHidden} data-label="${options[i].text}" data-index="${this.optionIndex}"><input class="${this.prefix}${this.checkboxInputClass} js-${this.checkboxClass}" type="checkbox" id="${uniqueName}" ${checked} ${disabled}><label class="${this.prefix}${this.checkboxLabelClass} ${this.prefix}${this.itemClass} ${this.prefix}${this.itemClass}--option" for="${uniqueName}"><span>${options[i].text}</span></label></li>`
|
|
300
308
|
this.optionIndex += 1
|
|
301
309
|
}
|
|
302
310
|
return list
|