Skip to content

Commit

Permalink
fix/multi-select (#346)
Browse files Browse the repository at this point in the history
* Update select.js

* Remove console.log
  • Loading branch information
laurenhitchon authored Sep 7, 2023
1 parent a2bf006 commit b3a1410
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class Select {
}

initButtonSelect() {
const triggerLabel = this.getSelectedOptionText(this.element)
const triggerLabel = this.getSelectedOptionText()

const button = `<button class="nsw-button nsw-multi-select__button" aria-label="${triggerLabel[1]}" aria-expanded="false" aria-controls="${this.selectId}-dropdown">
<span aria-hidden="true" class="nsw-multi-select__label">${triggerLabel[0]}</span>
Expand Down Expand Up @@ -246,15 +246,15 @@ class Select {
let ariaLabel = ''
const count = this.getSelectedOptionCount()

if (count === this.options.length) {
if (count === this.options.length && this.dropdown) {
label = `All ${this.textSelected}`
ariaLabel = `All ${this.textSelected}`
} else if (count > 1) {
label = `${count} ${this.textSelected}`
ariaLabel = `${count} ${this.textSelected}, Please select`
} else if (count > 0) {
ariaLabel += `${this.options[0].text}, Please select`
label = this.options[0].text
label = this.getSelectedOption().closest('.nsw-multi-select__option').dataset.label
} else {
label = noSelectionText
ariaLabel = 'Please select'
Expand Down

0 comments on commit b3a1410

Please sign in to comment.