Duolith docs

0039. Chips are toggle buttons; zoom is an <image zoomable> mode, shown by an ImageViewer part

  • Status: Proposed
  • Date: 2026-11-14
  • Decided by: integrator (internal only), pending Mik's approval
  • Planning item: WP7 (kit: chips, images)

Context

Two choices in the second half of the kit had more than one reasonable answer. Filter chips can be announced as toggle buttons (aria-pressed) or as checkboxes, and a single-choice group could be a radio group. A full-screen zoomable image can be a mode of the Image part or a part of its own, and the overlay layer that would normally hold it (decisions 0034 to 0036) is being built at the same time.

Decision

  • Chips are toggle buttons (aria-pressed), in a ChipGroup with role group, whether one or several may be chosen. Each chip is its own Tab stop; Enter or Space flips it. Pressing the chosen chip of a single-choice group unchooses it, which is what filters want and a radio cannot do; a checkbox would announce a form field where people expect a filter control. A standalone Chip flips itself with bind:selected; given onPress, the placing file decides, which is how ChipGroup drives its chips.
  • Zoom belongs to the image element and the full screen to a part. <image zoomable> gives any image the gestures (pinch, wheel, double-tap, pan while zoomed, a swipe down that runs on:dismiss), in the runtime's image-zoom.ts. ImageViewer is a separate part, a full-screen dialog around a zoomable image, opened with bind:open; **<Image zoomable>** places one and opens it when pressed. So a gallery can open one viewer for many thumbnails, and a single picture needs one attribute.
  • The viewer's focus handling is minimal and its own: while its zoomable image is inside a dialog, focus moves to the dialog's first control, Tab stays inside, Escape closes, and focus returns to where it was. The dialog is modal: everything outside it is inert, and the page and the screen behind it do not scroll. Closing it, or removing it with the part around it, undoes both. It moves onto the shared overlay layer when that lands, and the role list's dialog is merged with the overlay work's.

Alternatives considered

OptionWhy not
Checkbox semantics for chipsReads as a form field; screen readers say "checkbox" for what looks and acts like a button
A radio group for single-choice chipsCannot be cleared, and arrow-key choosing is surprising for filters
Only <Image zoomable>, no ImageViewer partA gallery could not open one viewer for a list of thumbnails
Only an ImageViewer part, zoom inside itThe gestures would be script in a part, which every target would reimplement; an image element mode maps to native zoom views
Build a small overlay layer hereDuplicates the overlay work in progress; two layers would have to be merged later

Consequences

  • The ImageViewer will be rebuilt on the shared overlay layer (focus scope, stacking, scroll lock) once it exists; its props stay the same. (Done: it is now an <overlay kind="dialog">, and the runtime's own copy of inertness and scroll lock in image-zoom.ts is gone.)
  • A swipe-to-dismiss is the only dismiss gesture the language has; a general on:swipe can replace on:dismiss if other parts need it.