Skip to content

Commit 96b78b0

Browse files
pierry01cirdes
andauthored
aria-disabled for Textarea (#235)
Co-authored-by: Cirdes <[email protected]>
1 parent 0945f2c commit 96b78b0

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

app/components/ruby_ui/textarea/textarea.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ def default_attrs
1919
ruby_ui__form_field_target: "input",
2020
action: "input->ruby-ui--form-field#onInput invalid->ruby-ui--form-field#onInvalid"
2121
},
22-
class: "flex w-full rounded-md border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50 border-border focus-visible:ring-ring placeholder:text-muted-foreground"
22+
class: [
23+
"flex w-full rounded-md border bg-background px-3 py-1 text-sm shadow-sm transition-colors border-border",
24+
"placeholder:text-muted-foreground",
25+
"disabled:cursor-not-allowed disabled:opacity-50",
26+
"file:border-0 file:bg-transparent file:text-sm file:font-medium",
27+
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
28+
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none"
29+
]
2330
}
2431
end
2532
end

app/views/docs/textarea.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ def view_template
2525
RUBY
2626
end
2727

28+
render Docs::VisualCodeExample.new(title: "Aria Disabled", context: self) do
29+
<<~RUBY
30+
div(class: "grid w-full max-w-sm items-center gap-1.5") do
31+
Textarea(aria: {disabled: "true"}, placeholder: "Aria Disabled")
32+
end
33+
RUBY
34+
end
35+
2836
render Docs::VisualCodeExample.new(title: "With FormField", context: self) do
2937
<<~RUBY
3038
div(class: "grid w-full max-w-sm items-center gap-1.5") do

0 commit comments

Comments
 (0)