SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

rowNavigation

Keyboard row navigation for a list or table.

tsx
import { rowNavigation } from "@sdxc/ui/app";

Usage

Walks a list's rows from the keyboard, registering its keys in the page's shortcut registry under the host's layer, so a list inside a sheet answers above the page's. Rows receive a 2px focus ring drawn inside their edge, so a scrolling container never clips it.

Signature

typescript
rowNavigation(options?: RowNavigation.Options): MixinDescriptor<HTMLElement>

Parameters

ParameterTypeRequiredDescription
optionsRowNavigation.OptionsNoWhich rows to walk, what opens one, and the copy each key lists under.

Examples

tsx
<ul mix={[rowNavigation({ search: "q", labels: { group: "List", next: "Next", previous: "Previous" } })]}>…</ul>

The events, constants and types its module publishes, each imported from @sdxc/ui/app too.

Event

RowPeekEvent

Dispatched, bubbling, on the focused row when Space asks to peek at it, so a page opens the row's detail beside the list while focus stays on the row.

typescript
new RowPeekEvent(row: HTMLElement)
PropertyTypeRequiredDescription
rowreadonly HTMLElementYesThe row asked about.
Constant

ROW_NAVIGATION_ROW_SELECTOR

Rows the mixin walks when its options name none: marked rows, table body rows, list items.

typescript
const ROW_NAVIGATION_ROW_SELECTOR = "[data-row], tbody > tr, :scope > li"
Constant

ROW_NAVIGATION_PRIMARY_SELECTOR

The control opening a row: one marked data-row-primary, else its first link.

typescript
const ROW_NAVIGATION_PRIMARY_SELECTOR = "[data-row-primary], a[href]"
Constant

ROW_NAVIGATION_ATTRIBUTE

Attribute every row the mixin has indexed carries, which its focus ring is drawn on.

typescript
const ROW_NAVIGATION_ATTRIBUTE = "data-row-navigation"
Constant

ROW_PEEK_EVENT

Event a row dispatches when Space asks to peek at it.

typescript
const ROW_PEEK_EVENT = "ui:row-peek" as const
Interface

RowNavigation.Labels

The copy each key lists under in the help sheet; an omitted label keeps that key unlisted.

MemberTypeRequiredDescription
groupstringNoThe help-sheet heading the keys list under.
nextstringNo
previousstringNo
openstringNo
togglestringNo
peekstringNo
searchstringNo
selectedstringNoAnnounced when x checks the row's checkbox.
deselectedstringNoAnnounced when x clears the row's checkbox.
Interface

RowNavigation.Options

Options for rowNavigation.

MemberTypeRequiredDescription
rowsstringNoRows to walk, matched inside the host. @default ROW_NAVIGATION_ROW_SELECTOR
withinstringNoThe nearest ancestor matching this selector becomes the host whose rows are walked, for a mixin carried by a marker element inside the list rather than the list itself.
primarystringNoThe control Enter and o press inside a row. @default ROW_NAVIGATION_PRIMARY_SELECTOR
searchstringNoThe id of the search field / focuses; omitted, / stays unbound.
peekbooleanNoBinds Space to dispatch RowPeekEvent on the focused row. @default false
labelsLabelsNo
announcerAnnouncerNoSays what x did, for a reader who cannot see the checkbox change.
@sdxc/ui

Can’t find it? Contact us