Skip to content

Commit

Permalink
Fix compiler “Type 'boolean' is not assignable to type 'string'”
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Jan 18, 2023
1 parent 8416bc4 commit 08cf1d4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/govuk/components/accordion/accordion.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ Accordion.prototype.setExpanded = function (expanded, $section) {
: this.i18n.t('showSection')

$showHideText.innerText = newButtonText
$button.setAttribute('aria-expanded', expanded)
$button.setAttribute('aria-expanded', expanded.toString())

// Update aria-label combining
var ariaLabelParts = []
Expand Down Expand Up @@ -413,7 +413,7 @@ Accordion.prototype.updateShowAllButton = function (expanded) {
? this.i18n.t('hideAllSections')
: this.i18n.t('showAllSections')

this.$showAllButton.setAttribute('aria-expanded', expanded)
this.$showAllButton.setAttribute('aria-expanded', expanded.toString())
this.$showAllText.innerText = newButtonText

// Swap icon, toggle class
Expand Down
2 changes: 1 addition & 1 deletion src/govuk/components/character-count/character-count.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ CharacterCount.prototype.updateScreenReaderCountMessage = function () {
if (this.isOverThreshold()) {
$screenReaderCountMessage.removeAttribute('aria-hidden')
} else {
$screenReaderCountMessage.setAttribute('aria-hidden', true)
$screenReaderCountMessage.setAttribute('aria-hidden', 'true')
}

// Update message
Expand Down
2 changes: 1 addition & 1 deletion src/govuk/components/checkboxes/checkboxes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Checkboxes.prototype.syncConditionalRevealWithInputState = function ($input) {
if ($target && $target.classList.contains('govuk-checkboxes__conditional')) {
var inputIsChecked = $input.checked

$input.setAttribute('aria-expanded', inputIsChecked)
$input.setAttribute('aria-expanded', inputIsChecked.toString())
$target.classList.toggle('govuk-checkboxes__conditional--hidden', !inputIsChecked)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/govuk/components/header/header.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Header.prototype.syncState = function () {
this.$menuButton.setAttribute('hidden', '')
} else {
this.$menuButton.removeAttribute('hidden')
this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen)
this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString())

if (this.menuIsOpen) {
this.$menu.removeAttribute('hidden')
Expand Down
2 changes: 1 addition & 1 deletion src/govuk/components/radios/radios.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Radios.prototype.syncConditionalRevealWithInputState = function ($input) {
if ($target && $target.classList.contains('govuk-radios__conditional')) {
var inputIsChecked = $input.checked

$input.setAttribute('aria-expanded', inputIsChecked)
$input.setAttribute('aria-expanded', inputIsChecked.toString())
$target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked)
}
}
Expand Down

0 comments on commit 08cf1d4

Please sign in to comment.