Skip to main content

Function: createPopup()

createPopup(view, registerKeyHandler): Popup

Defined in: extensions/popup.ts:266

Popup's one implementation. view and registerKeyHandler are the only things this reaches past plain DOM APIs. Escape folds into registerKeyHandler (C3, plans/reviews/2026-09-02-s5-start-fixes.md) instead of a bespoke document-capture listener + per-layer WeakMap LIFO stack: Keymap already resolves newest-registration-first, so a popup registering its Escape handler on open() and unregistering it on close() gets "innermost open thing wins" for free, and the shared isEditableTarget gate (S5.2, issue #137) restores the IME-composition rule this primitive was missing — a lone document listener with no gate closed a popup mid-IME-cancel too.

Parameters​

view​

PopupSurface

registerKeyHandler​

RegisterKeyHandler

Returns​

Popup