Rich text / foldkit-mixins-richtext

ApplicationControl

interface · packages/mixins-richtext/src/formatting.ts:56

interface ApplicationControl<Message> {
  readonly id: string
  readonly label: string
  readonly icon?: RichTextIconName | undefined
  readonly shortcut?: string | undefined
  readonly pressed?: boolean | undefined
  readonly disabled?: boolean | undefined
  readonly message: Message
  readonly popup?:
    | {
        readonly kind: 'menu' | 'dialog'
        readonly open: boolean
      }
    | undefined
}

A control of the application's own in the bar: it joins the same tab stop and the same arrow keys, in the place items gives it. message is what a press sends. A press of a disabled control sends nothing (the control is aria-disabled and stays focusable), and the application's update must refuse the Message in that state too, since a Message can arrive from elsewhere.

Members

ApplicationControl.id

property · packages/mixins-richtext/src/formatting.ts:58

readonly id: string

Unique among the application's controls; the element's id and data-item are app-<id>.

ApplicationControl.label

property · packages/mixins-richtext/src/formatting.ts:60

readonly label: string

The control's accessible name, and its visible text where it has no icon.

ApplicationControl.icon

property · packages/mixins-richtext/src/formatting.ts:61

readonly icon?: RichTextIconName | undefined

ApplicationControl.shortcut

property · packages/mixins-richtext/src/formatting.ts:63

readonly shortcut?: string | undefined

A foldkit-primitives pattern ('mod+k'), shown in the title and as aria-keyshortcuts.

ApplicationControl.pressed

property · packages/mixins-richtext/src/formatting.ts:65

readonly pressed?: boolean | undefined

aria-pressed, for a control that is on; absent for one that is not a toggle.

ApplicationControl.disabled

property · packages/mixins-richtext/src/formatting.ts:66

readonly disabled?: boolean | undefined

ApplicationControl.message

property · packages/mixins-richtext/src/formatting.ts:67

readonly message: Message

property · packages/mixins-richtext/src/formatting.ts:74

readonly popup?:
  | {
      readonly kind: 'menu' | 'dialog'
      readonly open: boolean
    }
  | undefined

A control that opens something the application draws, as link opens the link editor: aria-haspopup says which kind and, for a menu, aria-expanded says whether it is open. message then toggles it. ArrowDown on a closed menu's trigger and Escape on an open popup's trigger send message, as for the built-in menus.