From cb6b4c7512ac01b18c6a4e11cb7d01c57df9cd12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean=20Mendon=C3=A7a?= Date: Wed, 7 May 2025 14:50:30 +0000 Subject: [PATCH] aria-disabled for Command --- lib/ruby_ui/command/command_input.rb | 7 ++++++- lib/ruby_ui/command/command_item.rb | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/ruby_ui/command/command_input.rb b/lib/ruby_ui/command/command_input.rb index 3c2460f3..7d8cfe9c 100644 --- a/lib/ruby_ui/command/command_input.rb +++ b/lib/ruby_ui/command/command_input.rb @@ -38,7 +38,12 @@ def input_container(&) def default_attrs { - 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", + 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", + "aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none" + ], placeholder: @placeholder, 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", data_ruby_ui__command_target: "input", diff --git a/lib/ruby_ui/command/command_item.rb b/lib/ruby_ui/command/command_item.rb index 8b2c2aad..1d05c240 100644 --- a/lib/ruby_ui/command/command_item.rb +++ b/lib/ruby_ui/command/command_item.rb @@ -17,7 +17,14 @@ def view_template(&) def default_attrs { - 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", + 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", + "disabled:pointer-events-none disabled:opacity-50", + "aria-selected:bg-accent aria-selected:text-accent-foreground", + "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", + "aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none" + ], href: @href, role: "option", data: {