GhostScrollArea specification
Status: Approved (see the frontmatter evidence). Originally proposed for GHO-84, where spec and implementation shipped together.
Stick-to-bottom amendment (0.4.0). Approved on 2026-12-01 by @zprue743, together with the rest of this specification. Adds opt-in following for chat logs and other streaming views: the stickToBottom prop, the stuck model, and the scrollToBottom() method. The rules are decisions ST1–ST12. The rest of this contract is unchanged. The chat pieces that compose with it, and the end-to-end streaming chat trace, are in the GhostChatMessage specification.
Purpose and user problems
GhostScrollArea is a constrained overflow container with predictable layout and accessibility behavior. It clips or scrolls content that exceeds a bounded region without custom scrollbar widgets, sticky orchestration, or virtualization.
Sighted users scroll with pointer, trackpad, or native scrollbars. Keyboard users can reach overflowed content when the region has no other focusable descendants, using the same keys as a native scrollable element. Assistive technology encounters a scrollable region with an accessible name when the root is in the tab order.
Immediate consumers include tall lists in side panels, bounded dialog bodies, and horizontally overflowed table wrappers ahead of GhostDataTable. Those need native scrolling, stable layout, and axe-clean focus rules (scrollable-region-focusable).
Chat logs, build output, and other streaming views need one more behavior: the view follows new content at the bottom while the reader is at the bottom, and stops following as soon as the reader scrolls up to read something earlier. Without it, apps set scrollTop by hand after every chunk through the exposed element, and each one handles the reader scrolling up (or fails to) in its own way. stickToBottom owns that behavior.
Non-goals
- Custom scrollbar rendering, drag-to-scroll thumbs, or scrollbar-only styling as a requirement. Themed CSS may style native scrollbars where the platform allows it; consumers are not forced to replace native scrolling.
- Virtualization, infinite scroll, or scroll-position persistence.
- Keeping the reader's place when older history is prepended above. Native scroll anchoring (
overflow-anchor) handles this where the engine supports it; the component neither enables nor disables it. - Sticking to the start or to the inline end.
stickToBottomfollows the physical bottom of a vertical scroller only. Vertical writing modes are not supported. - Animated following. Following is always instant; only an explicit
scrollToBottom({ behavior: 'smooth' })animates. - Announcing new content. The scroll area adds no live region; the chat recipe owns announcements (see the chat specification).
- Sticky rows/columns, scroll syncing, or DataTable-specific orchestration.
- Window-level scroll locking (
useScrollLockstays separate). - Split panes / window splitters (APG window splitter pattern).
- Focus trapping inside the region; parent widgets own that when needed.
- Shadow DOM scroll portals or nested viewport/corner/scrollbar part trees.
Public API
Props and configuration
Headless @ghostvue/vue GhostScrollArea / useGhostScrollArea:
| Prop | Type | Default | Contract |
|---|---|---|---|
orientation | 'vertical' | 'horizontal' | 'both' | 'vertical' | Which axes may scroll. Vertical is overflow-y; horizontal is overflow-x; both allow either axis when content exceeds the box. |
type | 'auto' | 'scroll' | 'auto' | Maps to native overflow-*: auto vs scroll. auto shows scrollbars when needed; scroll always reserves the scrollable overflow mode on enabled axes. |
as | 'div' | 'div' | Host element. Closed union; widened only additively. |
label | string | undefined | When the root is a tab stop with no tabbable descendants, sets role="region" and aria-label. Provide whenever case (1) applies so the name is valid for ARIA. |
Stick-to-bottom props (amendment):
| Prop | Type | Default | Contract |
|---|---|---|---|
stickToBottom | boolean | false | Opt in to following new content at the bottom (ST1). Applies to vertical and both. With horizontal it is ignored and a development warning is logged once per instance. |
stuck | boolean | omitted | v-model:stuck. Whether the view is following. Omit for uncontrolled mode, which starts true. Ignored while stickToBottom is not effective. See v-model contracts. |
type GhostScrollAreaElement = 'div'
type GhostScrollAreaOrientation = 'vertical' | 'horizontal' | 'both'
type GhostScrollAreaOverflowType = 'auto' | 'scroll'
interface GhostScrollAreaScrollToBottomOptions {
/** `'smooth'` falls back to `'auto'` under `prefers-reduced-motion: reduce`. */
behavior?: 'auto' | 'smooth'
}useGhostScrollArea gains three options and two return values:
interface UseGhostScrollAreaOptions {
// existing: as, label, orientation, type
stickToBottom?: MaybeRefOrGetter<boolean | undefined>
/** Controlled stuck state; `undefined` is uncontrolled (starts `true`). */
stuck?: MaybeRefOrGetter<boolean | undefined>
/** Called with the next stuck state on every component-caused change. */
onStuckChange?: (stuck: boolean) => void
}
// added to the composable's return value
stuck: Readonly<Ref<boolean>>
scrollToBottom: (options?: GhostScrollAreaScrollToBottomOptions) => voidNamed ESM exports: GhostScrollArea, useGhostScrollArea, and the types above. Headless behavior lives in the composable; the SFC is a thin root that merges rootProps and the default slot.
Native attributes and listeners fall through to the single root (id, class, data-*, aria-labelledby, style, dir, etc.). The component owns class, data-part, data-orientation, data-type, data-overflow, data-stuck, overflow-related inline style, conditional tabindex, and when label is set on an active tab stop, role="region" with aria-label. Consumer onScroll, onWheel, onKeydown, onTouchstart, and onPointerdown listeners are merged with the component's stick-to-bottom listeners on the root, never replaced. The suspension-ending listeners (ST9) live on window only while a suspension is active. The component's listeners are passive where the event allows it and never call preventDefault or stop propagation.
Themed @ghostvue/themes GhostScrollArea must expose the same handle (element, scrollToBottom) and re-emit update:stuck, so the themed component, which the chat recipe uses, has the full surface.
Themed @ghostvue/themes GhostScrollArea wraps the unstyled component. Same behavioral props; no extra visual props. Importing it loads the default stylesheet and wraps the instance in .ghost-themed-scope.
v-model contracts
Overflow detection is internal state exposed via data-overflow for styling, not for v-model.
v-model:stuck (stuck / update:stuck) is the only model. It has meaning only while stickToBottom is effective. useControllableState owns the write path:
- Controlled iff
stuckis notundefined. Uncontrolled starts attrue, so a freshly mounted log opens at its newest content. - The component writes the state when the reader releases it (ST5, ST6) or returns to the bottom (ST7), and when
scrollToBottom()runs. Each write skips whenObject.is(current, next), writes local state when uncontrolled, then emitsupdate:stucksynchronously inside the DOM event or observer callback that caused it. Mount never emits. - A consumer write takes effect when the prop changes to a value that differs from the component's current state. Setting
truescrolls to the bottom instantly, asscrollToBottom()does, and resumes following. Settingfalsestops following and leaves the scroll position where it is. - Echoes are bounded to the emit they acknowledge. When the component emits
update:stuck(true)and the prop is not alreadytrue, it records one pending acknowledgement. The next prop change totrueconsumes it and does not scroll, so a parent echoingtrueafterscrollToBottom({ behavior: 'smooth' })does not cut the animation short. Any later emit or any other prop change clears the pending acknowledgement. A prop change that equals the component's current state does nothing. A consumer that ignored an earliertrue, let the reader scroll up again, and later setstruegets the scroll, because the reader's release cleared the acknowledgement. - In controlled mode the prop is the truth. A consumer that ignores
update:stuck(false)keeps the view following, so the reader's next scroll up is undone by the next content change. That is the consumer's choice (for example a kiosk log) and is documented, not prevented. - Turning
stickToBottomoff stops all following and removesdata-stuck. Turning it back on resumes from the currentstuckvalue; if that istrue, the view scrolls to the bottom immediately.
Events, callbacks, slots, and exposed methods
- Default slot: scrollable content. No nested viewport slot.
- Events:
update:stuck(boolean) for the model above. Nativescrolllisteners attach via fallthrough. - Exposed:
elementgetter for the rootHTMLElement, andscrollToBottom(options?: GhostScrollAreaScrollToBottomOptions): void.scrollToBottomscrolls the root to its maximumscrollTop. It works whether or notstickToBottomis set. WithstickToBottomeffective, it first setsstucktotrue(emitting if that changes it), so following continues from there. The defaultbehavioris'auto'(instant). It is a no-op before mount and after unmount.
State model
Configuration props (orientation, type, as, label) are consumer-owned. Runtime state:
| State | Meaning |
|---|---|
data-overflow | none when no enabled axis overflows; otherwise vertical, horizontal, or both. |
| Tab stop | Root receives tabindex="0" only when at least one enabled axis overflows and the subtree has no tabbable descendants (excluding the root). Otherwise tabindex is omitted. While the root itself has focus, the component does not remove tabindex, role, or aria-label; it applies a pending removal on blur. |
data-stuck | Present only while stickToBottom is effective (true, and orientation is not horizontal): "true" while following, "false" after the reader releases it. |
Overflow and focusable-content detection run after mount and on resize or slot text/content changes (ResizeObserver on the root and added element children; MutationObserver limited to childList and characterData with subtree, not attribute churn on the root). Server render omits tabindex and uses data-overflow="none".
Stick to bottom
These decisions define stickToBottom. "Distance" means scrollHeight − clientHeight − scrollTop on the root, and "at the bottom" means a distance of 2 CSS pixels or less. The 2px tolerance absorbs fractional scrollTop values under browser zoom; it is an internal constant, not API.
The component keeps a recorded position: the root's scrollTop, refreshed after every scroll write the component makes, in every observer callback (whether content grew or shrank), and in every scroll event. "Moved up" means a scroll event whose scrollTop is lower than the recorded position.
Every scroll write the component makes (mount, follow, instant return) uses scrollTo({ top, behavior: 'instant' }), so a consumer or theme scroll-behavior: smooth on the root never animates following.
ST1. Opt-in. Nothing changes unless
stickToBottomis true andorientationisverticalorboth. When it is not effective, the component adds no listeners, renders nodata-stuck, and never emitsupdate:stuck.scrollToBottom()still works.ST2. State.
stuckis the following state (v-model).data-stuckmirrors it. Overflow is not required: a short log that does not overflow stays stuck and starts following as soon as it does.ST3. Engage on mount. When the component mounts with
stucktrue, it scrolls to the maximum in the mount hook, without waiting for an animation frame, so a client-rendered log never paints at the top. Under SSR the server HTML paints first at the top; the jump happens at hydration (see SSR and hydration).ST4. Follow. While stuck and not held (ST5) or suspended (ST9), the component scrolls to the maximum whenever the content grows or the root's own height shrinks (a composer grows, a virtual keyboard opens). Two paths detect growth:
- Before paint. The existing
ResizeObserverwatches the root and its direct element children. When it reports a change, the follow step runs inside that callback, after layout and before paint, so no frame shows the content cut off. - Backstop. The existing
MutationObserver(childListandcharacterDataon the subtree) always schedules a check for the next animation frame. IfscrollHeighthas grown since the last check, the follow step runs then. This covers growth noResizeObserverentry reports: text placed directly in the root, a direct child withdisplay: contents, or a direct child with a fixed height. Following on this path is one frame late. It is also the only path whereResizeObserveris missing.
The docs recommend one direct element child that grows with the content (the chat recipe's
<ol>) so following always takes the before-paint path. Following is always instant, never moves focus, and never changes the selection.- Before paint. The existing
ST5. Release when the reader scrolls up. While stuck:
- Hold on intent. A
wheelevent on the root or a descendant withdeltaY < 0and noctrlKey(Ctrl+wheel is zoom), or akeydownwhose target is the root itself forArrowUp,PageUp,Home, orShift+Space, starts a hold whenscrollTop > 0. A hold pauses following without changingstuck, so a content change that arrives before the browser scrolls cannot snap the reader back. - Release on an upward scroll. A
scrollevent that moved up and leaves the distance above 2px setsstucktofalse, with or without a hold. This covers wheel and key scrolling, scrollbar dragging, touch dragging, assistive-technology scrolling, find-in-page, and a consumer's ownscrollIntoViewof earlier content. - Hold expiry. If no upward scroll arrives within two animation frames of the latest hold-starting event, the hold ends,
stuckstaystrue, and a follow step runs. This is the outcome when the wheel scrolled a nested scroller (a code block) instead of the root, or a consumer handler cancelled the wheel.
Keys on focused descendants are not inspected; their own scrolling is covered by item 2 and by ST6. The component never calls
preventDefaulton these events.- Hold on intent. A
ST6. Keyboard focus is never scrolled away. While stuck, if a descendant of the root (not the root) has focus, matches
:focus-visible, and a follow step would move it entirely out of the root's visible box, the component releases (stuckbecomesfalse) instead of following, leavingscrollTopunchanged. A keyboard user on a link in an earlier message keeps it on screen. Focus from a pointer (a mouse click on "Copy") does not release; the pointer case is handled by ST9 while the button is pressed, and a mouse reader who keeps reading the stream keeps following it.ST7. Re-engage at the bottom. A
scrollevent whosescrollTopdiffers from the recorded position and leaves the distance at 2px or less setsstucktotrue, unless a hold (ST5) or suspension (ST9) is active. Events caused by the component's own writes match the recorded position and never re-engage. Reaching the bottom by wheel,End, a fling, or dragging the scrollbar resumes following.ST8. Return on request.
scrollToBottom()and a consumer write ofstuck = trueboth setstucktotrueand scroll to the maximum. Withbehavior: 'smooth'(only fromscrollToBottom), the intermediatescrollevents move down and never release. A content change during the animation follows instantly to the new bottom, which ends the animation. Awheelup during the animation starts a hold and then releases, as in ST5. In controlled mode, the parent echoing the value the component just emitted is not a consumer write and does not scroll (see v-model contracts), so a smooth return is not cut short.ST9. Pointer and touch suspension. A primary
pointerdownor atouchstarton the root or any descendant suspends following without changingstuck. This keeps content from moving under a pressed button (the click lands on what the user pressed) and from fighting a finger before the firstscrollevent. While suspended, an upward scroll still releases (ST5 item 2), but ST7 re-engagement waits. The suspension ends onpointeruporpointercancelfor that pointer, or ontouchend/touchcancelonce no touches remain, listened for onwindow(added at suspension start, removed at its end), so releasing outside the root or on a node removed mid-press still ends it. Unmount also ends it. At the end:- If the distance is 2px or less,
stuckbecomestrue(emitting if it wasfalse) and a follow step runs. - Otherwise, if
stuckis stilltrue(the reader pressed or rested a finger without scrolling up while content arrived), a follow step runs and catches up. - Otherwise the view stays released.
- If the distance is 2px or less,
ST10. Shrinking content. When content shrinks and the browser clamps
scrollTop, the observer callback that sees the shrink refreshes the recorded position to the clamped value. The clamp'sscrollevent then does not move up, and a clamp followed by growth in the same frame never reads as the reader scrolling up. Because thatscrollevent matches the recorded position, ST7 does not see it; instead the same observer callback re-engages: if the view is released, no hold or suspension is active, and the distance after the clamp is 2px or less,stuckbecomestrue(emitting) and later growth is followed.ST11. No announcements, no focus moves. Following never moves focus, never adds a live region, and never changes
role,tabindex, or the accessible name. Announcing new chat messages is the consumer's job; the chat specification gives the pattern.ST12. Reduced motion. Following is already instant.
scrollToBottom({ behavior: 'smooth' })checksprefers-reduced-motion: reducewhen called and scrolls instantly when it matches.
Loading, empty, disabled, read-only, and error states
None apply. Empty slot content is valid; overflow stays none. An empty stick-to-bottom log is stuck and follows its first content.
Async behavior
No async work beyond layout observation debounced to animation frames. The stick-to-bottom follow step (ST4) runs inside the ResizeObserver callback rather than a later frame. Release and re-engage run synchronously inside the DOM event that causes them, so the model and data-stuck never lag the reader's input by a frame.
Consumer data
The component does not accept data props and mutates no consumer-owned objects. It measures its own layout box and subtree focusability.
Accessibility contract
Semantics and relationships
Native scrolling on a div (or other host). When the root is a tab stop and label is set, the component assigns role="region" with aria-label so the name is valid under ARIA.
Focusable scroll container rules (axe scrollable-region-focusable):
- When content overflows on an enabled axis and there are no tabbable descendants, the root must be focusable (
tabindex="0") and named (label/aria-label/aria-labelledbyvia fallthrough). - When tabbable descendants exist, the root is not in the tab order; keyboard users scroll via focused descendants or pointer/trackpad.
- When nothing overflows, the root is not focusable even if empty.
Overflowing static text with no tab stops matches case (1) and is the primary DataTable-adjacent scenario for horizontal overflow.
Keyboard interaction
No component key handlers change scrolling. When the root is focused (tabindex="0") with overflow, the user agent scrolls the native overflow container (arrows, Page Up/Down, Home/End, Space, and equivalent assistive-technology scroll gestures). The component does not call preventDefault on keyboard events.
With stickToBottom, the component observes keys on the focused root only to release following before the native scroll (ST5):
| Key on the focused root | Native result | Stick-to-bottom effect |
|---|---|---|
ArrowUp, PageUp, Home | Scrolls up | Holds, then releases on the scroll (ST5) |
Shift+Space | Scrolls up a page | Holds, then releases on the scroll |
ArrowDown, PageDown, Space | Scrolls down | Re-engages if the scroll reaches the bottom |
End | Scrolls to bottom | Re-engages (ST7) |
Focus behavior
The root enters the tab order only per the table in State model. It does not trap or restore focus. Visible focus follows the platform outline on the scrollable root.
Assistive technology expectations
When focusable and named, the scrollable region is announced as a focusable element with its label; scrolling is performed after focus via keyboard or assistive-technology scroll gestures. When not focusable, assistive technology reads descendants normally.
Stick-to-bottom adds nothing to the accessibility tree. data-stuck is a styling hook, not state exposed to assistive technology. Screen-reader virtual cursors read the DOM in order regardless of scroll position, so following does not interrupt reading. A screen reader that scrolls the view to its reading position releases following through ST5 item 2, which keeps later content from pulling the view away.
Rendering and customization
Single root element with a default slot. Stable styling hooks:
- class
ghost-scroll-area data-part="root"data-orientation="vertical" | "horizontal" | "both"data-type="auto" | "scroll"data-overflow="none" | "vertical" | "horizontal" | "both"data-stuck="true" | "false"(only whilestickToBottomis effective)
Overflow axes use inline overflow-x / overflow-y from orientation and type. Consumers size the box (max-block-size, max-inline-size, flex child constraints, etc.) via attrs or parent layout.
Themed CSS under .ghost-theme / .ghost-themed-scope adds:
overscroll-behavior: containon the root to reduce scroll chaining into the page- touch-friendly momentum scrolling where supported
- scrollbar clearance from
data-orientation:padding-inline-endforvertical,padding-block-endforhorizontal, and both forboth, each set to--ghost-space-inset-scrollbar. Overlay scrollbars ignorescrollbar-gutterand draw over the scrollport, so this padding keeps content out from under them. It is keyed on orientation rather thandata-overflow, so it is present before content overflows and adds no layout shift. Classic scrollbars sit beside the padding. Logical properties keep it on the scrollbar side in RTL. Consumerpaddingon the root replaces it (the recipe is in a zero-specificity layer). scrollbar-gutter: stablewhendata-type="scroll"- native scrollbar color tokens where the engine supports
scrollbar-color scroll-behavior: autounderprefers-reduced-motion: reduce
Token use is limited to semantic tokens: --ghost-border-strong for the scrollbar thumb and --ghost-space-inset-scrollbar for clearance. The clearance token is a semantic space.inset token (16px, the same at every density because platform scrollbars do not scale with density), not a component token; any scroll container may use it.
Environment behavior
SSR and hydration
Initial markup uses configuration props and data-overflow="none". Overflow measurement and tabindex assignment run only in the browser after mount, avoiding hydration mismatches. An integration test uses expectSsrHydration.
With stickToBottom, the server renders data-stuck from the initial state ("true" when uncontrolled), so hydration matches. The server cannot set a scroll position, so server-rendered HTML first paints at the top of the content and jumps to the bottom when the component mounts during hydration (ST3). Apps that cannot accept that jump render the log on the client only. The docs say so. A CSS-only bottom start (flex-direction: column-reverse) is out of scope because it reverses the order that keyboard and assistive technology see unless the DOM is reversed too.
Mobile and touch
Native touch scrolling on the root. No custom touch handlers. The themed recipe may set -webkit-overflow-scrolling: touch. Minimum target size is not imposed on the root; focusable children keep their own sizes.
With stickToBottom, a passive touchstart listener on the root and touchend / touchcancel listeners on window only suspend following while a finger is down (ST9); they never change scrolling. When a virtual keyboard opens and the layout shrinks the root, ST4 keeps a stuck view at the bottom. iOS momentum scrolling that overshoots the bottom and bounces back leaves the distance at 0 and does not release.
Performance
ResizeObserver (when available) watches the root; overflow checks are coalesced with requestAnimationFrame. No virtualization. Expected scale is modest DOM subtrees (hundreds of nodes), not million-row tables.
Stick-to-bottom reuses the same observers. A follow step reads scrollHeight and clientHeight once and writes scrollTop once per observer callback, so a stream that appends text every few milliseconds costs one layout read and one write per frame. The backstop check (ST4 item 2) is one scrollHeight read per frame in which a mutation happened, coalesced with the existing overflow measurement frame. Listeners are passive where the event allows it and are removed on unmount; window listeners exist only during a pointer or touch suspension. A log of a few thousand messages is the expected ceiling; longer histories need virtualization, which stays out of scope.
Composition
useGhostScrollArea owns orientation/type styles, overflow measurement, tabindex policy, stick-to-bottom state and listeners, and data-* hooks. GhostScrollArea binds the composable to a template ref and slot. Themed wrapper adds scoped stylesheet load only and forwards stickToBottom, v-model:stuck, and scrollToBottom().
Stick-to-bottom stays inside useGhostScrollArea rather than a separate useGhostStickToBottom composable: it needs the same observers, the same root element, and the same overflow measurement. A separate export can follow additively if a non-ScrollArea scroller needs it. useControllableState owns the stuck model, as it does for other GhostVue models.
Manifests: packages/vue/manifests/ghost-scroll-area.manifest.json and packages/themes/manifests/ghost-scroll-area.manifest.json.
Test plan
- Vue tests: default hooks, orientation/type overflow styles,
data-overflowupdates when layout overflows (stubbed metrics), tabindex when overflow without tabbables, no tabindex with tabbable children,label→aria-labelwhen region role when labeled tab stop, no key interception, attribute fallthrough, SSR HTML withouttabindex. - Composable tests: overflow axis matrix, focusable-descendant detection, tabindex and
aria-labelpolicy. - Integration:
expectSsrHydrationwith slotted static content. - Browser: playground scenarios (vertical list, horizontal strip, themed bounded region), axe scan without
scrollable-region-focusableviolations. - Browser: themed scrollbar clearance. For each orientation in LTR and RTL, the themed root's computed padding on the scrollbar edges equals
--ghost-space-inset-scrollbar, the content box ends at least that far from the scrollbar edge of the scrollport, and the docs examples' last timestamp and tile borders stay clear of the scrollbar region. - Visual baselines: registered examples via
pnpm test:visual:docker. - No compile-time consumer fixtures: closed unions only.
Stick-to-bottom additions:
- Composable tests (stubbed metrics and events): ST1 no listeners, no
data-stuck, and no emit when off orhorizontal(with the one-time dev warning); mount scroll without emit (ST3); follow on content growth and on root shrink (ST4 item 1); backstop follow for text placed directly in the root and for adisplay: contentschild (ST4 item 2); a hold fromwheelup and from each ST5 key on the root, released only by an upwardscroll; hold expiry when no upward scroll follows (nested scroller, cancelled wheel) leavesstucktrue; Ctrl+wheel starts no hold; a queuedscrollfrom the component's own write after a hold neither releases nor re-engages (nofalse, true, falsesequence); no release from keys on a descendant or from ascrollthat moves down; shrink then grow within one frame does not release (ST10); ST6 release for a:focus-visibledescendant and no release for pointer focus; re-engage at 2px (ST7);scrollToBottomsets and emitsstuckonly on change; controlledstucktrue and false writes; a controlled consumer that ignores an emittedtrue, lets the reader release, and later writestruegets an immediate scroll; a released view clamped to the bottom by shrinking content re-engages from the observer callback and follows the next growth (ST10); a controlled echo after a smoothscrollToBottomdoes not cut it short (ST8); ST9 suspension ends fromwindowpointerupoutside the root, fromtouchendon a removed target, and on unmount, with each of the three end outcomes; reduced-motion downgrade (ST12); all writes usebehavior: 'instant'; listener cleanup on unmount; consumeronScroll/onWheel/onKeydownstill called. - Tab-stop tests: a focused root keeps
tabindex,role, andaria-labelwhen tabbable content arrives, and drops them onblur. - Vue tests:
v-model:stuckround trip,data-stuckvalues, exposedscrollToBottom, SSR markup withdata-stuck="true"and no scroll position, each through both the headless and the themedGhostScrollArea(v-model:stuck,scrollToBottom(), andelementreachable from the themed component). - Integration:
expectSsrHydrationwithstickToBottomand slotted content. - Browser (Playwright, real layout): a streaming fixture appends text every 50ms. Assert the last line stays visible while stuck; a mouse wheel up releases and the position holds across later chunks;
Endon the focused root re-engages;scrollToBottom()returns and resumes; a keyboard-focused button in an earlier message stays visible while chunks arrive (ST6); a mouse click on a button in a moving message lands on that button (ST9); a touch drag up releases and a drag back to the bottom re-engages on lift (ST9); a wheel over a nested scrollable block leaves following on (ST5 item 3); a root withscroll-behavior: smoothstill follows instantly. Run once withreducedMotion: 'reduce'. - Axe scan of the streaming fixture with following on and off.
Documentation plan
docs/components/scroll-area.md with API reference, vertical, horizontal, composable, themed, and accessibility sections; playground gallery section; roadmap status update.
The stick-to-bottom amendment adds a "Stick to bottom" section with a streaming log example (examples/scroll-area/stick-to-bottom.vue) that shows v-model:stuck driving a "Jump to latest" button, the SSR first-paint note, and a link to the chat page for the full chat recipe. The playground gains a streaming log exercise.
Compatibility and release impact
Additive; minor Changesets for @ghostvue/vue and @ghostvue/themes.
The stick-to-bottom amendment is additive and opt-in: stickToBottom defaults to false, and an instance without it renders the same markup and attaches the same listeners as before. It ships with minor Changesets for @ghostvue/vue and @ghostvue/themes. New public contracts: the stickToBottom and stuck props, update:stuck, scrollToBottom(), the three composable options, data-stuck, and the 2px bottom tolerance as observable behavior.
Keeping a focused root's tabindex, role, and aria-label until blur fixes focus dropping to the document when tabbable content arrives. It applies with or without stickToBottom and is a patch-level behavior fix in the same Changeset.
Open architectural questions
None blocking.
- GHO-38 styling hooks. Uses existing
data-part/data-*attributes only. - Custom scrollbars. Out of scope; native-first per issue.