Scroll panels
Restrict long lists to an independently scrollable region.
Live preview
Task 1 Queued
Task 2 Queued
Task 3 Queued
Task 4 Queued
Task 5 Queued
Task 6 Queued
Task 7 Queued
Task 8 Queued
Task 9 Queued
HTML
<div class="xsh-scroll-panel" tabindex="0" role="region" aria-label="Recent tasks">
<div>Task 1 <span class="xsh-badge">Queued</span>
</div>
<div>Task 2 <span class="xsh-badge">Queued</span>
</div>
<div>Task 3 <span class="xsh-badge">Queued</span>
</div>
<div>Task 4 <span class="xsh-badge">Queued</span>
</div>
<div>Task 5 <span class="xsh-badge">Queued</span>
</div>
<div>Task 6 <span class="xsh-badge">Queued</span>
</div>
<div>Task 7 <span class="xsh-badge">Queued</span>
</div>
<div>Task 8 <span class="xsh-badge">Queued</span>
</div>
<div>Task 9 <span class="xsh-badge">Queued</span>
</div>
</div>Installation & markup
Include the local stylesheet and script once on the page, then place the component inside a data-xsh-ui root. The example above works without a build system.
<link rel="stylesheet" href="/dist/xshna-ui.css">
<div data-xsh-ui>
<!-- Add the HTML example above -->
</div>
<script defer src="/dist/xshna-ui.js"></script>Component API
Public classes, attributes and hooks used by this example. Keep the xsh- prefix intact.
| Identifier | Contract |
|---|---|
xsh-scroll-panel | Used by the example markup and component styles or behavior. |
tabindex | Used by the example markup and component styles or behavior. |
role=region | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
The scroll region can be focused and scrolled with keyboard.
Implementation note. Do not trap users inside a scrolling region.
Interaction contract
Behavioral components use the shared delegated runtime; visual-only primitives rely on semantic HTML and CSS. Runtime controls emit bubbling xsh:* CustomEvents; bind application handlers to those events when server persistence, API data or navigation is required.