OGE logoOGE

Window

oge-window is a non-modal floating window: no backdrop, no focus trap and no scroll lock, so the page stays usable and several windows can be open at once. A press or focus brings a window to the front, the title bar drags it, eight edge handles resize it and the title-bar buttons minimize, maximize and restore it — every gesture has a keyboard twin. For a blocking dialog use oge-modal.

oge-window [(opened)] [(state)] (moved)

Basics

Open it through the two-way opened model or open() / close() / toggle(). The window is a role="dialog" without aria-modal, labelled by its title: nothing behind it is blocked, focus moves into it on open (autoFocus) and back to the opener when it closes. Escape closes it only while focus is inside and no popup is open — a window never joins the modal Escape stack.

[(opened)] non-modal role=dialog
The page behind stays interactive.

Multiple windows & stacking

Any number of windows can be open. They share one z-order — across component trees and both render layers — on top of the --oge-z-window token (below anchored popups, so a select opened inside a window still shows above it). A press or focus brings a window to the front and fires activated; the frontmost window's title bar carries the active accent. zIndex sets a base of your own.

z-order bringToFront() (activated) zIndex
active: —

Drag & resize (keyboard too)

The title bar drags the window and eight edge and corner handles resize it — both through the shared pointer gesture (3px threshold, touch-safe, Escape mid-gesture puts the window back). The keyboard twin works on the focused frame (Tab reaches it, a title-bar press focuses it): arrows move by 10px, Ctrl/⌘ + arrows resize, Shift makes either step 1px, and the result is announced. minWidth/minHeight/maxWidth/maxHeight bound the size; moved and resized report the new box and the source.

draggable resizable min/max keyboard twin
not moved yet

Minimize / maximize

Minimize collapses the window to its title bar, maximize fills the viewport (inside the safe-area insets), restore brings the previous box back. Title-bar buttons (labels from the overlay messages), a title-bar double-click, Alt+↑ / Alt+↓, the two-way state model and minimize() / maximize() / restore() all run the cancelable stateChanging → stateChanged pipeline.

[(state)] stateChanging minimize() maximize()
state: normal

Placement & constraints

Without a position the window opens at its placement — the centre, an edge (top, bottom, logical start / end) or a corner — and a new placement re-places an open window. position ({ x, y } in viewport px) wins and moves the window when it changes. keepInViewport (default) keeps the whole window on screen; with false it may hang off the sides and bottom, but its title bar always stays reachable. A viewport resize re-clamps open windows.

placement position keepInViewport RTL

Events

Every interaction reports through an event: cancelable opening, closing (with the reason — 'escape', 'closeButton', 'api') and stateChanging; past-tense closed, moved, resized, stateChanged and activated. Interact with the window and watch the log.

opening closing moved stateChanged activated

Notes

  • Window or modal? A window never blocks the page: use it for tool palettes, inspectors and side-by-side work. A decision the user must take before going on belongs in a modal (or the confirm() helper).
  • Coordinates are viewport pixels (x is the left edge, like clientX) in both reading directions; only placements name logical edges.
  • The title-bar button labels localize through the overlay messages (windowMinimize, modalMaximize, modalRestore, modalClose) and the keyboard announcements through windowMoved / windowResized.