Class: Shadcn::MessageScroller::Content::Component

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

Overview

The column of messages, and the tail spacer under it.

The spacer is not decoration and not a slot: it is a hidden sibling of the rows whose height the controller sets, so the last message can be scrolled to the top of the viewport rather than stopping at the bottom (components.tsx:301-307). It is also the reason scroll_geometry.js measures the rows instead of reading scrollHeight, which the spacer inflates.

role="log" with aria-relevant="additions" is upstream's default and is what makes an arriving message announce itself. Both are defaults, so a caller who knows better can say so.

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

#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

#callObject



33
34
35
# File 'app/components/shadcn/message_scroller/content/component.rb', line 33

def call
  render_element(body: safe_join([ content, spacer ]))
end

#element_attributes(**defaults) ⇒ Object



25
26
27
28
29
30
31
# File 'app/components/shadcn/message_scroller/content/component.rb', line 25

def element_attributes(**defaults)
  super(**{
    role: "log",
    "aria-relevant" => "additions",
    "data-shadcn--message-scroller-target" => "content"
  }.merge(defaults))
end