Skip to content

Commit cb6b4c7

Browse files
committed
aria-disabled for Command
1 parent e4264da commit cb6b4c7

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

lib/ruby_ui/command/command_input.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ def input_container(&)
3838

3939
def default_attrs
4040
{
41-
class: "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
41+
class: [
42+
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none",
43+
"placeholder:text-muted-foreground",
44+
"disabled:cursor-not-allowed disabled:opacity-50",
45+
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none"
46+
],
4247
placeholder: @placeholder,
4348
data_action: "input->ruby-ui--command#filter keydown.down->ruby-ui--command#handleKeydown keydown.up->ruby-ui--command#handleKeydown keydown.enter->ruby-ui--command#handleKeydown keydown.esc->ruby-ui--command#dismiss",
4449
data_ruby_ui__command_target: "input",

lib/ruby_ui/command/command_item.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ def view_template(&)
1717

1818
def default_attrs
1919
{
20-
class: "relative flex cursor-pointer select-none items-center gap-x-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
20+
class: [
21+
"relative flex cursor-pointer select-none items-center gap-x-2 rounded-sm px-2 py-1.5 text-sm outline-none",
22+
"hover:bg-accent hover:text-accent-foreground",
23+
"disabled:pointer-events-none disabled:opacity-50",
24+
"aria-selected:bg-accent aria-selected:text-accent-foreground",
25+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
26+
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none"
27+
],
2128
href: @href,
2229
role: "option",
2330
data: {

0 commit comments

Comments
 (0)