diff --git a/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs b/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs index 519dbd483a3..51219441b82 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.hbs @@ -8,6 +8,7 @@ @action={{this.toggleSectionLinks}} @label="sidebar.more" class="btn-flat sidebar-more-section-links-details-summary" + aria-expanded={{if this.open "true" "false"}} /> diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js index cab4af31383..a793ef8148c 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js @@ -60,6 +60,13 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) { "additional section links are displayed" ); + assert.ok( + exists( + ".sidebar-section[data-section-name='community'] .sidebar-more-section-links-details-summary[aria-expanded='true']" + ), + "aria-expanded toggles to true when additional links are displayed" + ); + await click( ".sidebar-section[data-section-name='community'] .sidebar-more-section-links-details-summary" ); @@ -83,6 +90,13 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) { ), "additional section links are hidden when clicking outside" ); + + assert.ok( + exists( + ".sidebar-section[data-section-name='community'] .sidebar-more-section-links-details-summary[aria-expanded='false']" + ), + "aria-expanded toggles to false when additional links are hidden" + ); }); test("clicking on everything link", async function (assert) {