Popups
Dialogs keep var(--sideSpace) clearance from every viewport edge, including on narrow screens. It
defaults to var(--space-3) (1em). Override it on the theme root to match your app's spacing. With size: 'auto', smaller popups fit their content on mobile just as they do on desktop. Larger popups
remain constrained by the viewport. Use size: 'full' for the larger manager/editor layout.
Setup
Jhana UI uses a singleton Svelte component. You have to include this once in your root layout. Then you can use the popup system across your whole app.
In case you're not happy with the default popup config, you can just set the values of the config object.
Usage
Once set up, you can just use the pop function anywhere. Either directly in the components or you might set up one file that contains all the popups your app uses.
Instead of the `pop` function you can also use Svelte syntax using the OpenPopup component. It reacts to mount and unmount.
Here you can see nested popups in use. This shows a way to organize a collection of popups that work together.
Enter and the primary action
Plain Enter runs the last visible primary footer action by default, without a form or focus on that button. This example uses Cover Designer's account-save confirmation. Open it and press Enter to confirm, or Tab to Cancel and press Enter to cancel. No extra keyboard configuration is needed.
No action yet
The initial focus is on the dialog itself, unless content requests autofocus. Tab order is unchanged. Enter on a focused button or link keeps its normal action. Textareas, contenteditable, selects, open ComboBoxes and nested dialogs/popovers keep their own Enter behavior. Control handlers can consume Enter with preventDefault(). Held-key repeats, composition and modifier keys do not run the shortcut. Closing returns focus to the previous control or parent popup when it is still available.
Disabled/loading defaults do nothing. Hidden primary alternatives are skipped, and a split button uses its main action. Custom footer buttons participate through their primary class and existing click/disabled behavior. A primary-colored control in the body does not become the default. A popup without a primary has no new Enter action.
Use form: true when you need native validation and form submission. Enter validates the wrapping form before running its primary action, including when it contains several inputs. Button clicks retain their existing handlers. The form's existing no-primary submission fallback still resolves its current value.
OpenPopup accepts the same submitOnEnter prop. Opting out disables the popup shortcut and its wrapping form's
implicit Enter submission. Clicking, Enter on an explicitly focused button and explicit requestSubmit() still
work. Initial focus follows the browser's existing behavior for opted-out popups. Full guidance ships in docs/popups.md.