Other
Runtime
The browser behaviour of server-rendered components.
Components render plain HTML. The runtime binds what HTML cannot express: menus, dialogs, date
pickers, dependent fields, number entry, help drawers and navigation tools.
attachDesignSystemInteractions binds everything under a root: the whole page, or one island's
element.
#When to use
- Load
faifo-design/runtime/auto.jsonce for a server-rendered page; it attaches to the document. - An island that renders design-system markup calls
attachDesignSystemInteractions(root)on its own element and disposes it with the island. - The row anchor helpers return a reader to the row they left when they come back from a record.
#API
Generated from the package source. A property without a description has none in the source yet.
#attachDesignSystemInteractionsFunction
Binds the interactions of every component under root: the whole page, or one island's element.
function attachDesignSystemInteractions(root?: Document | HTMLElement | undefined) => (): void| Parameter | Type |
|---|---|
root | Document | HTMLElement |
| Returns | () => void |
#attachPeekInteractionsFunction
Focus lifetime for a PeekLayout whose Peek an application island renders and replaces. Attach once per layout. The application owns which record is peeked (usually peek=<id> in the URL) and keeps the view interactive; invokers name the layout's place (peekId, which stays in the DOM while the peek is closed) with aria-controls, and the current one carries aria-current="true". The runtime only: - moves focus into the panel when an invoker opens it, not when a page loads with it open; - keeps focus in the view when another invoker replaces the content (the heading is a polite live region, so the new record is announced); - closes on Escape through the peek's close control unless a layer above owns Escape; - when the user closes it, returns focus to the item it showed (after paging, not the original invoker); when the application closes it, only if focus would otherwise be lost; - where the peek is a sheet (below 64rem), scrolls the invoker out from under it.
function attachPeekInteractions(layout: HTMLElement) => (): void| Parameter | Type |
|---|---|
layoutrequired | HTMLElement |
| Returns | () => void |
#readRowAnchorFunction
The row a collection URL returns to, with where it stood on screen if this history entry remembers it, otherwise from the measured return fragment. Unmeasured links have null top.
function readRowAnchor(url?: { hash: string; } | undefined, state?: unknown): { id: string; top: number | null; left?: number | undefined; } | null| Parameter | Type |
|---|---|
url | { hash: string } |
state | unknown |
| Returns | { id: string; top: number | null; left?: number | undefined; } | null |
#rememberRowAnchorFunction
Call when a plain click (not one opening a new tab) follows a row link: the current entry names that row and its position, so Back returns to it.
function rememberRowAnchor(link: Element): string | null| Parameter | Type |
|---|---|
linkrequired | Element |
| Returns | string | null |
#restoreRowAnchorFunction
Once the rows are rendered: scroll the anchored row back to where it stood (or to the middle of the view when that is unknown or no longer on screen) and focus its link without scrolling again, unless focus is already inside the row. Scroll restoration is handed back to the browser either way.
function restoreRowAnchor(root: ParentNode, anchor: { id: string; top: number | null; left?: number | undefined; }): boolean| Parameter | Type |
|---|---|
rootrequired | ParentNode |
anchorrequired | { id: string, top: number | null, left?: number } |
| Returns | boolean |
#rowAnchorHrefFunction
The collection link that returns to one row: href with its fragment set to the row.
function rowAnchorHref(href: string, rowId: string, position?: { top?: number | null | undefined; left?: number | undefined; } | undefined): string| Parameter | Type |
|---|---|
hrefrequired | string |
rowIdrequired | string |
position | { top?: number | null, left?: number } |
| Returns | string |
#takeRowAnchorFunction
The anchor of the page being loaded. While it waits for the rows, the browser must not restore an old scroll offset over a page that is still short, so scroll restoration is manual until restoreRowAnchor has run.
function takeRowAnchor(): { id: string; top: number | null; left?: number | undefined; } | null