Skip to content

Commit

Permalink
Expanded override for trigger as well as target (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
hopsoft authored Feb 6, 2023
1 parent 9f6ccae commit 9d122d8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/turbo_boost/elements/tag_builders/toggle_tags_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def trigger_tag(
focus_selector: nil, # CSS selector for the element to focus when the target is expanded
method: :toggle, # method to inovke (:show, :hide, :toggle)
disabled: false, # disable the trigger
expanded: false, # override to force expansion
remember: false, # remember ephemeral UI state between requests
**kwargs, # generic support for additional element attributes like `class` etc.
&block # a Ruby block that emits this trigger's content
Expand All @@ -36,7 +37,7 @@ def trigger_tag(
# aria
kwargs[:aria] ||= {}
kwargs[:aria][:controls] = controls # toggle target
kwargs[:aria][:expanded] = target_expanded?(controls)
kwargs[:aria][:expanded] = expanded || target_expanded?(controls)
kwargs[:aria][:atomic] ||= true
kwargs[:aria][:relevant] ||= "all"

Expand All @@ -57,8 +58,8 @@ def target_tag(
id, # REQUIRED, the `dom_id` for the element
collapse_on: [], # list of events that will collapse this target
collapse_selector: nil, # CSS selector for other matching targets to collapse when this target is expanded
expanded: false, # override to force expansion
focus_selector: nil, # CSS selector for the element to focus when this target is expanded
expanded: false, # override to force expansion
**kwargs, # generic support for additional element attributes like `class` etc.
&block # a Ruby block that emits this target's content
)
Expand Down

0 comments on commit 9d122d8

Please sign in to comment.