Class: Shadcn::HoverCard::Content::Component

Inherits:
ApplicationViewComponent show all
Defined in:
app/components/shadcn/hover_card/content/component.rb

Overview

HoverCardContent.

It carries the same pointer handlers as the trigger, and that is the component rather than a detail: without them, moving onto the card is leaving the trigger and the card closes under the pointer that went for it (hover-card.tsx:220-221).

No role and no aria-*, which is Radix's own — measured, there is not one of either in the whole primitive. The card is a sighted-hover affordance, and nothing in it is announced. That is also why every tabbable inside it is taken out of the tab order; the controller does that, since the content is a host's markup rather than this component's.

Constant Summary

Constants inherited from ApplicationViewComponent

ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS

Instance Attribute Summary

Attributes inherited from ApplicationViewComponent

#attributes

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



33
34
35
36
37
38
39
40
41
# File 'app/components/shadcn/hover_card/content/component.rb', line 33

def element_attributes(**defaults)
  super(**{
    hidden: true,
    "data-state" => "closed",
    "data-shadcn--hover-card-target" => "content",
    "data-action" => "pointerenter->shadcn--hover-card#open " \
                     "pointerleave->shadcn--hover-card#close"
  }.merge(defaults))
end