Class: Shadcn::Command::Separator::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Command::Separator::Component
- Defined in:
- app/components/shadcn/command/separator/component.rb
Overview
A rule between groups, and decorative: aria-hidden where cmdk writes
role="separator" (vendor/cmdk/index.tsx:780).
A role="listbox" may only contain options and groups, and upstream's
own palette puts the separator inside the list — so cmdk's markup makes
the listbox invalid, and axe fails it. Nothing is lost by hiding it: a
separator with no name conveys nothing to a screen reader, and the
groups either side of it are already named. This is the same call the
toaster made about a role on an <li>.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #initialize, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Constructor Details
This class inherits a constructor from Shadcn::ApplicationViewComponent
Instance Method Details
#element_attributes(**defaults) ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/components/shadcn/command/separator/component.rb', line 23 def element_attributes(**defaults) super(**{ "cmdk-separator" => "", "aria-hidden" => "true", "data-shadcn--command-target" => "separator" }.merge(defaults)) end |