Skip to content

Commit 1c2ccee

Browse files
authored
fix: add aria-expanded on ms-drop element, fixes #178 (#179)
- fixes #178
1 parent 4224fb6 commit 1c2ccee

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/src/MultipleSelectInstance.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ export class MultipleSelectInstance {
208208
this.choiceElm.appendChild(createDomElement('div', { className: 'icon-caret' }));
209209

210210
// default position is bottom
211-
this.dropElm = createDomElement('div', { className: `ms-drop ${this.options.position}` }, this.parentElm);
211+
this.dropElm = createDomElement(
212+
'div',
213+
{ className: `ms-drop ${this.options.position}`, ariaExpanded: 'false' },
214+
this.parentElm
215+
);
212216

213217
// add data-name attribute when name option is defined
214218
if (name) {
@@ -446,6 +450,7 @@ export class MultipleSelectInstance {
446450
if (!dropVisible) {
447451
this.dropElm.style.left = '-10000';
448452
this.dropElm.style.display = 'block';
453+
this.dropElm.ariaExpanded = 'true';
449454
}
450455

451456
const updateDataOffset = () => {
@@ -479,6 +484,7 @@ export class MultipleSelectInstance {
479484
if (!dropVisible) {
480485
this.dropElm.style.left = '0';
481486
this.dropElm.style.display = 'none';
487+
this.dropElm.ariaExpanded = 'false';
482488
}
483489
} else {
484490
if (this.ulElm) {
@@ -992,6 +998,7 @@ export class MultipleSelectInstance {
992998
this.parentElm.classList.add('ms-parent-open');
993999
this.choiceElm?.querySelector('div')?.classList.add('open');
9941000
this.dropElm.style.display = 'block';
1001+
this.dropElm.ariaExpanded = 'true';
9951002

9961003
if (this.selectAllElm?.parentElement) {
9971004
this.selectAllElm.parentElement.style.display = 'block';
@@ -1083,6 +1090,7 @@ export class MultipleSelectInstance {
10831090
this.parentElm.classList.remove('ms-parent-open');
10841091
this.choiceElm?.querySelector('div')?.classList.remove('open');
10851092
this.dropElm.style.display = 'none';
1093+
this.dropElm.ariaExpanded = 'false';
10861094

10871095
if (this.options.container) {
10881096
this.parentElm.appendChild(this.dropElm);

0 commit comments

Comments
 (0)