Skip to content

Commit

Permalink
fix: radio field accessibility on actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob committed Feb 14, 2025
1 parent 8609c42 commit 1f1ef97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/components/avo/fields/radio_field/edit_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<div class="flex flex-col gap-2">
<% @field.options.each do |key, value| %>
<div>
<%= form.radio_button @field.id, key %>
<%= form.label @field.id, value, value: value %>
<%= form.radio_button @field.id, key, checked: (@field.value.to_s == key.to_s) %>
<%= form.label @field.id, value, value: key %>
</div>
<% end %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/app/avo/actions/sub/dummy_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Avo::Actions::Sub::DummyAction < Avo::BaseAction
end

def fields
field :size, as: :radio, options: {small: "Small Option", medium: "Medium Option", large: "Large Option"}
field :size, as: :radio, options: {small: "Small Option", medium: "Medium Option", large: "Large Option"}, default: :medium
TestBuddy.hi("Dummy action fields")
field :keep_modal_open, as: :boolean
field :persistent_text, as: :text
Expand Down

0 comments on commit 1f1ef97

Please sign in to comment.