Skip to content

Commit

Permalink
Merge pull request #3359 from CSCfi/fix-action-labels
Browse files Browse the repository at this point in the history
Fix action buttons rendering wrong label
  • Loading branch information
Macroz authored Nov 25, 2024
2 parents e0efd95 + 21e245c commit ccf7357
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cljs/rems/collapsible.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,19 @@

(defn- base-action
"Base attributes for collapsible action."
[{:keys [collapsible-id label] :as action}]
[{:keys [collapsible-id] :as action}]
(let [state @(rf/subscribe [::expanded collapsible-id])]
(-> action
(dissoc :collapsible-id :hide? :on-close :on-open :show?)
(assoc :aria-controls collapsible-id
:aria-expanded (if state
"true"
"false"))
(assoc-some :label (cond label nil
state (text :t.collapse/hide)
:else (text :t.collapse/show))))))
(assoc-some :label (when-not (or (:label action)
(:text action))
(if state
(text :t.collapse/hide)
(text :t.collapse/show)))))))

(defn focus-on-first-input [id]
(focus/scroll-into-view-and-focus (rfmt/format "#%s .collapse-open :is(textarea, input)" id)))
Expand Down

0 comments on commit ccf7357

Please sign in to comment.