Class: Shadcn::MessageScroller::Viewport::Component

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

Overview

The scroll container. Three of its classes are shadcn's own CSS rather than Tailwind's — scroll-fade-b, scrollbar-thin, scrollbar-gutter-stable — reproduced at the end of shadcn.css; without them these would be inert and parity_spec, which compares class text and not generated CSS, would not notice.

data-autoscrolling:scrollbar-none is the one variant here that reads an attribute the controller writes: the scrollbar is hidden while a programmatic scroll is in flight, so a smooth jump does not flicker one in and out.

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

tabindex: 0 is the primitive's (components.tsx:209) and is not decoration: a scrollable region with no focusable content inside it cannot be scrolled from a keyboard at all unless it is focusable itself. axe fails the page without it, which is how the omission was found.



32
33
34
35
36
37
# File 'app/components/shadcn/message_scroller/viewport/component.rb', line 32

def element_attributes(**defaults)
  super(**{
    tabindex: 0,
    "data-shadcn--message-scroller-target" => "viewport"
  }.merge(defaults))
end