Hosanna UI API v1.40.0-next
    Preparing search index...

    FocusManager is responsible for managing focus within the application. It handles input events, focus transitions, and focus locking mechanisms.

    Implements

    Index

    Constructors

    Properties

    focusDebugGroup?: ISGNGroup

    Debug group for visualizing focus.

    focusDebugLabel?: ISGNLabel

    Debug label for visualizing focus.

    focusDebugRect?: ISGNRectangle

    Debug rectangle for visualizing focus.

    focusedView?: IFocusable

    The currently focused view.

    focusLockedView?: IFocusable

    The view on which focus is locked.

    focusSource: FocusChangeSource = 'programmatic'
    inputEvent: HsInputEvent = ...

    The current normalized input event being dispatched.

    inputEventNotification: INotification<HsInputEvent<IHosannaView<ViewState>>> = ...
    isAppLaunching: boolean = false
    isFocusLocked: boolean = false

    Indicates whether focus is currently locked.

    isLockedOnNativeRenderer: boolean = false

    Indicates whether the focus is locked on the native renderer.

    keyToDirectionMap: Record<string, api.Direction> = ...

    A mapping of keys to navigation directions.

    lastFocusedView: undefined | IFocusable

    The last view that was focused.

    lastNavigationRepeatAt: number = 0
    lastNavigationRepeatKey: Key = Key.None
    nativeFocusedRenderer?: ISGNNode

    The native SceneGraph node that currently has platform focus (e.g. Roku focusedChild). May differ from focusedView.renderer when focus is locked on a native renderer.

    navigationRepeatIntervalMs: number = 180

    Minimum interval between repeated directional focus moves during a long press.

    textToSpeechManager: ITextToSpeechManager

    Methods

    • Internal method to handle periodic updates for focus management.

      Returns void

    • Returns whether possibleAncestor contains focusTarget in the focus hierarchy.

      Walking upwards avoids recursively searching every sibling subtree. The check is deliberately performed each time it is needed so hierarchy changes made by focus callbacks are observed by the remainder of the transition.

      Parameters

      Returns boolean

    • Focuses on the next control in the specified direction.

      Parameters

      Returns undefined | false

      True if focus was successfully moved, false otherwise.

    • Notifies parent views of a focused child change event.

      Parameters

      • child: IFocusable & IIdentifiable

        The child view that triggered the event.

      Returns void

    • Registers an error for the specified view.

      Parameters

      • message: string

        The error message.

      • view: IFocusable

        The view associated with the error.

      Returns void

    • Dev relay only — implementation is registered from app bootstrap (e.g. BaseApp).

      Parameters

      • focusedView: IHosannaView<ViewState>

      Returns void

    • Returns boolean

    • Resets the focus state.

      Returns void

      Error if not implemented.

    • Returns void

    • Sets focus to the specified view.

      Parameters

      • newFocus: IFocusable

        The view to focus on.

      • forced: boolean = false

        Whether to force the focus change (default: false).

      • focusSource: FocusChangeSource = 'programmatic'

      Returns IOperationResult

      An operation result indicating success or failure.

    • Sets the native focus on the specified renderer or the global scene.

      Parameters

      • Optionalrenderer: ISGNNode

        The renderer to set focus on (optional).

      Returns void

    • Configures the minimum interval between repeated directional focus moves during a long press.

      Parameters

      • intervalMs: number

        The interval in milliseconds. Values below 0 are treated as 0.

      Returns void

    • Returns boolean