~nicolaskempf57/select-a11y

8ccbb4b1a18a5d337314de741ed0ae0211d8cf90 — Nicolas KEMPF 4 months ago 75409a4
chore: update dist
2 files changed, 10 insertions(+), 8 deletions(-)

M dist/main.js
M dist/module.js
M dist/main.js => dist/main.js +5 -4
@@ 366,15 366,16 @@ class $21b19656d700fd08$var$Select {
        }
    }
    _toggleSelection(optionIndex, close = true) {
        const option = this.el.item(optionIndex);
        const option1 = this.el.item(optionIndex);
        if (this.multiple) this.el.item(optionIndex).selected = !this.el.item(optionIndex).selected;
        else this.el.selectedIndex = optionIndex;
        this.el.dispatchEvent(new Event('change'));
        this.suggestions.forEach((function(suggestion) {
        this.suggestions.forEach((suggestion)=>{
            const index = parseInt(suggestion.getAttribute('data-index'), 10);
            if (this.el.item(index).selected) suggestion.setAttribute('aria-selected', 'true');
            const option = this.el.item(index);
            if (option && option.selected) suggestion.setAttribute('aria-selected', 'true');
            else suggestion.removeAttribute('aria-selected');
        }).bind(this));
        });
        this._setButtonText();
        if (this.multiple && this._options.showSelected) this._updateSelectedList();
        if (close && this.open) this._toggleOverlay();

M dist/module.js => dist/module.js +5 -4
@@ 356,15 356,16 @@ class $5a3b80354f588438$var$Select {
        }
    }
    _toggleSelection(optionIndex, close = true) {
        const option = this.el.item(optionIndex);
        const option1 = this.el.item(optionIndex);
        if (this.multiple) this.el.item(optionIndex).selected = !this.el.item(optionIndex).selected;
        else this.el.selectedIndex = optionIndex;
        this.el.dispatchEvent(new Event('change'));
        this.suggestions.forEach((function(suggestion) {
        this.suggestions.forEach((suggestion)=>{
            const index = parseInt(suggestion.getAttribute('data-index'), 10);
            if (this.el.item(index).selected) suggestion.setAttribute('aria-selected', 'true');
            const option = this.el.item(index);
            if (option && option.selected) suggestion.setAttribute('aria-selected', 'true');
            else suggestion.removeAttribute('aria-selected');
        }).bind(this));
        });
        this._setButtonText();
        if (this.multiple && this._options.showSelected) this._updateSelectedList();
        if (close && this.open) this._toggleOverlay();