From 14879992fe5cfbc16638a6e3dd3850e0319a15f6 Mon Sep 17 00:00:00 2001 From: Justin Littman Date: Wed, 5 Jul 2023 17:49:36 -0400 Subject: [PATCH] Adds aria-expanded for See more options. refs #3170 --- app/components/works/subtypes_component.html.erb | 2 +- app/components/works/work_type_modal_component.html.erb | 2 +- app/javascript/controllers/more_types_controller.js | 2 ++ app/javascript/controllers/work_type_modal_controller.js | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/components/works/subtypes_component.html.erb b/app/components/works/subtypes_component.html.erb index 6b5c1fa33..b73748afd 100644 --- a/app/components/works/subtypes_component.html.erb +++ b/app/components/works/subtypes_component.html.erb @@ -39,7 +39,7 @@ <% unless mixed_material_type? %> - <% end %> diff --git a/app/components/works/work_type_modal_component.html.erb b/app/components/works/work_type_modal_component.html.erb index 7fa917032..2089edacb 100644 --- a/app/components/works/work_type_modal_component.html.erb +++ b/app/components/works/work_type_modal_component.html.erb @@ -65,7 +65,7 @@
- diff --git a/app/javascript/controllers/more_types_controller.js b/app/javascript/controllers/more_types_controller.js index fa68916b0..0d2fee960 100644 --- a/app/javascript/controllers/more_types_controller.js +++ b/app/javascript/controllers/more_types_controller.js @@ -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) } } diff --git a/app/javascript/controllers/work_type_modal_controller.js b/app/javascript/controllers/work_type_modal_controller.js index 7337ab806..40b50a75e 100644 --- a/app/javascript/controllers/work_type_modal_controller.js +++ b/app/javascript/controllers/work_type_modal_controller.js @@ -61,6 +61,7 @@ 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() } @@ -68,6 +69,7 @@ export default class extends Controller { this.moreTypesTarget.hidden = true this.moreTypesLinkTarget.innerHTML = 'See more options' this.moreTypesLinkTarget.classList.toggle('collapsed', true) + this.moreTypesLinkTarget.setAttribute('aria-expanded', false) } displaySubtypeOptions(type) {