Skip to content

Commit

Permalink
NVDA fix
Browse files Browse the repository at this point in the history
Remove `tabindex='-1'` from input, add `tabindex='-1'` to button. When
input active, apply hover style to button.
  • Loading branch information
patrickpatrickpatrick committed Jan 9, 2025
1 parent 9c6749f commit baaf4f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,8 @@
margin-bottom: 0;
margin-left: govuk-spacing(2);
}

.govuk-file-upload-wrapper:active button {
background-color: $govuk-focus-colour;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export class FileUpload extends GOVUKFrontendComponent {
'govuk-button govuk-button--secondary govuk-file-upload__button'
$button.type = 'button'
$button.innerText = this.i18n.t('selectFilesButton')
// Prevent the button being tabbed to by keyboard users
$button.setAttribute('tabindex', '-1')
$button.addEventListener('click', this.onClick.bind(this))

// Create status element that shows what/how many files are selected
Expand All @@ -106,9 +108,6 @@ export class FileUpload extends GOVUKFrontendComponent {
this.$button = $button
this.$status = $status

// Prevent the hidden input being tabbed to by keyboard users
this.$root.setAttribute('tabindex', '-1')

// Syncronise the `disabled` state between the button and underlying input
this.updateDisabledState()
this.observeDisabledState()
Expand Down

0 comments on commit baaf4f7

Please sign in to comment.