weasel API - v0.8.0
    Preparing search index...

    Interface CanvasFocusReturn

    interface CanvasFocusReturn {
        focused: boolean;
        focusProps: { onBlur: () => void; onFocus: () => void; tabIndex: number };
        getFocused: () => boolean;
        setFocused: (next: boolean) => void;
    }
    Index

    Properties

    focused: boolean

    Live boolean — true when the element has DOM focus. Triggers re-renders when the focus state changes (set via React state).

    focusProps: { onBlur: () => void; onFocus: () => void; tabIndex: number }

    Spread onto the focusable element (e.g. the canvas). Includes tabIndex, onFocus, onBlur.

    getFocused: () => boolean

    Stable getter for the live focused state. Use inside per-frame closures like RenderLayer.draw, where the layer is constructed once and reading focused directly would capture the value at construction time. The getter always returns the current value.

    setFocused: (next: boolean) => void

    Imperative focus / blur. Useful for tests and programmatic control.