Skip to content

Commit 07c0922

Browse files
pierry01cirdes
andauthored
aria-disabled for RadioButton (#231)
* aria-disabled for RadioButton * OOPS --------- Co-authored-by: Cirdes <[email protected]>
1 parent b9ab013 commit 07c0922

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

app/components/ruby_ui/radio_button/radio_button.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def default_attrs
1717
},
1818
class: [
1919
"h-4 w-4 p-0 border-primary rounded-full flex-none",
20-
"disabled:cursor-not-allowed disabled:opacity-50"
20+
"disabled:cursor-not-allowed disabled:opacity-50",
21+
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none"
2122
]
2223
}
2324
end

app/views/docs/radio_button.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,24 @@ def view_template
2727
RUBY
2828
end
2929

30+
render Docs::VisualCodeExample.new(title: "Disabled", context: self) do
31+
<<~RUBY
32+
div(class: "flex flex-row items-center gap-2") do
33+
RadioButton(class: "peer",id: "disabled", disabled: true)
34+
FormFieldLabel(for: "disabled") { "Disabled" }
35+
end
36+
RUBY
37+
end
38+
39+
render Docs::VisualCodeExample.new(title: "Aria Disabled", context: self) do
40+
<<~RUBY
41+
div(class: "flex flex-row items-center gap-2") do
42+
RadioButton(class: "peer", id: "aria-disabled", aria: {disabled: "true"})
43+
FormFieldLabel(for: "aria-disabled") { "Aria Disabled" }
44+
end
45+
RUBY
46+
end
47+
3048
render Components::ComponentSetup::Tabs.new(component_name: component)
3149

3250
render Docs::ComponentsTable.new(component_files(component))

0 commit comments

Comments
 (0)