Class: Shadcn::Menubar::Content::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Menubar::Content::Component
- Defined in:
- app/components/shadcn/menubar/content/component.rb
Overview
A menu's panel. Wider than the dropdown's (min-w-[12rem] against
min-w-[8rem]), and it reads --radix-menubar-*, which is why it is
written out rather than inherited.
It carries no data-[state=closed]:animate-out, which the dropdown's
does. That is upstream's string as vendored, not an omission here.
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
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/components/shadcn/menubar/content/component.rb', line 27 def element_attributes(**defaults) super(**{ role: "menu", # Neither is upstream's markup — Radix's FocusScope and Menu add # them at runtime, which is why they are in the dropdown's content # and not in either vendored file. The `tabindex` is load-bearing: # without it `focus()` on the panel is silently a no-op, so the # panel never holds the focus, and Escape, the typeahead and the # arrow keys are all left listening on an element nothing types # into. tabindex: "-1", "aria-orientation" => "vertical", hidden: true, "data-state" => "closed", "data-shadcn--dropdown-menu-target" => "content", "data-action" => "keydown->shadcn--dropdown-menu#contentKeydown " \ "keydown->shadcn--menubar#contentKeydown" }.merge(defaults)) end |