Skip to content

A platform for community discussion. Free, open, simple.

A11Y: add aria tags for topic map expansion (#20122)

Krisbb2341b82c99
diff --git a/app/assets/javascripts/discourse/app/widgets/topic-map.js b/app/assets/javascripts/discourse/app/widgets/topic-map.js
index d408931dedf..3cdce4732dd 100644
--- a/app/assets/javascripts/discourse/app/widgets/topic-map.js
+++ b/app/assets/javascripts/discourse/app/widgets/topic-map.js
@@ -254,6 +254,8 @@ createWidget("topic-map-summary", {
? "topic.expand_details"
: "topic.collapse_details",
icon: state.collapsed ? "chevron-down" : "chevron-up",
+ ariaExpanded: state.collapsed ? "false" : "true",
+ ariaControls: "topic-map-expanded",
action: "toggleMap",
className: "btn",
})
@@ -296,7 +298,7 @@ createWidget("topic-map-link", {
});
createWidget("topic-map-expanded", {
- tagName: "section.topic-map-expanded",
+ tagName: "section.topic-map-expanded#topic-map-expanded",
buildKey: (attrs) => `topic-map-expanded-${attrs.id}`,
defaultState() {