Skip to content

Commit

Permalink
Adds aria-expanded for See more options.
Browse files Browse the repository at this point in the history
refs #3170
  • Loading branch information
justinlittman committed Jul 5, 2023
1 parent 227557b commit 1487999
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/components/works/subtypes_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</div>

<% unless mixed_material_type? %>
<a href="#" class="more-options collapsed" data-action="more-types#toggleMoreTypes" data-more-types-target="moreTypesLink">
<a href="#" class="more-options collapsed" data-action="more-types#toggleMoreTypes" data-more-types-target="moreTypesLink" aria-expanded="false" role="button">
See more options
</a>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/components/works/work_type_modal_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

<div class="mb-4 subtype-container" data-work-type-modal-target="subtype"></div>

<a href="#" class="more-options collapsed" data-action="work-type-modal#toggleMoreTypes" data-work-type-modal-target="moreTypesLink" hidden>
<a href="#" class="more-options collapsed" data-action="work-type-modal#toggleMoreTypes" data-work-type-modal-target="moreTypesLink" hidden aria-expanded="false" role="button">
See more options
</a>

Expand Down
2 changes: 2 additions & 0 deletions app/javascript/controllers/more_types_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ export default class extends Controller {
this.moreTypesTarget.hidden = false
this.moreTypesLinkTarget.innerHTML = 'See fewer options'
this.moreTypesLinkTarget.classList.toggle('collapsed', false)
this.moreTypesLinkTarget.setAttribute('aria-expanded', true)
}

hideMoreTypes() {
this.moreTypesTarget.hidden = true
this.moreTypesLinkTarget.innerHTML = 'See more options'
this.moreTypesLinkTarget.classList.toggle('collapsed', true)
this.moreTypesLinkTarget.setAttribute('aria-expanded', false)
}
}
2 changes: 2 additions & 0 deletions app/javascript/controllers/work_type_modal_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ export default class extends Controller {
this.moreTypesTarget.hidden = false
this.moreTypesLinkTarget.innerHTML = 'See fewer options'
this.moreTypesLinkTarget.classList.toggle('collapsed', false)
this.moreTypesLinkTarget.setAttribute('aria-expanded', true)
this.continueButtonTarget.focus()
}

hideMoreTypes() {
this.moreTypesTarget.hidden = true
this.moreTypesLinkTarget.innerHTML = 'See more options'
this.moreTypesLinkTarget.classList.toggle('collapsed', true)
this.moreTypesLinkTarget.setAttribute('aria-expanded', false)
}

displaySubtypeOptions(type) {
Expand Down

0 comments on commit 1487999

Please sign in to comment.