DatumHueEnterprise v0.0.24datumhue.com
Contents

Input, focus and Back

Input goes to one app at a time: the focused one. Inside that app, keys and a gamepad move focus from widget to widget, and Back goes to the innermost part of the UI that can take it.

Which app hears input

Windows stack with the most recently focused in front. Focusing an app brings its window forward; datumhue.app.is_focused says whether your app has focus, and the app_focused and app_unfocused events tell you when that changes. A new app takes focus when the app that started it had focus, or manages the app that had it.

Your app sees real input only while it, or an app it manages, is focused. Every other app reads input as if nothing were pressed, so an app in the background never sees what someone types:

What an app in the background readsValue
a key or a button heldfalse
a pointer or touch positionnil
a stick{ x = 0, y = 0 }
a trigger0

The pointer's look (shown, hidden, locked, its icon) belongs to each app, and changes with focus.

Stacking. The root app is the workstation's base layer: focusing it gives it input without covering the windows it manages, and its own popovers and menus stack above those windows. An app that manages visible windows stacks its popovers and menus above the highest of them. Any other app's popovers and menus stack just above its own window, under a window focused in front of it.

Reserved shortcuts. A window manager can keep key chords, such as Alt+Tab, and the gamepad's View, Menu and Guide buttons for itself with datumhue.wm.grab_input. A press it grabs goes to its on_press handler, and reaches no app as input. The face buttons, the D-pad, the bumpers and the triggers can never be grabbed: your app always gets those.

Focus inside your app

One widget of your app holds focus, datumhue.ui.focused, and keys and gamepad A go to it. Every widget works from the keyboard and a gamepad with no extra code:

InputMoves focus
Tabto the next widget, in order
the arrow keys, the D-pad, the left stickto the nearest widget in that direction
a press or a tapto the widget pressed; a button made with keep_input_focus leaves your app's focused text field focused

A widget keeps the arrow keys it uses itself: a slider its left and right, a text field its caret keys. Each app keeps its focused widget while another app is in front, and has it again when focused.

A game that reads the arrow keys or the D-pad itself has them as long as it shows no widget that takes focus. A game with widgets on screen turns this off with datumhue.ui.focus_navigation. Keyboard and gamepad has every rule.

Where Back goes

Escape, gamepad B, the mouse's back button, a browser's Back and a phone's back gesture all make one cancel request. Escape, B and the mouse's back button make one only while focus navigation is on, so a game that turned it off keeps them for itself. Escape in a focused text field always makes one.

In a browser the mouse's back button is the browser's Back, and it always makes one, as a phone's back gesture does.

The request goes from the inside out, and the first of these that is there takes it:

  1. a dialog of the workstation's own, which presses its Cancel;
  2. in a browser, a Continue chip DatumHue shows for your app or for the workstation, which goes away without running what it held;
  3. an open menu, or a popover made with light_dismiss, which closes;
  4. a focused text field, which runs its on_cancel and lets go of focus;
  5. from the focused widget outward, the first element with a cancel handler (UiElement:on_cancel), or a router made with pop_on_cancel that has a page to go back to;
  6. the frame your window manager put around your app.

A request no part of your app takes goes on to the window manager, which usually takes the person out of your app. Handle Back shows how to decide what Back does in your app.

See also

Reference used on this page: datumhue.app.is_focused datumhue.wm.grab_input datumhue.ui.focused datumhue.ui.focus_navigation UiElement:on_cancel

datumhue.com

(c) 2026 Shuusei AB. Quote excerpts of this manual, with attribution to DatumHue, in your own documentation, tutorials, course materials, reviews, and other writing or video. Republishing it in whole or in substantial part needs written permission: support@datumhue.com.

Victor Mono is licensed under the SIL Open Font License 1.1
Copyright (c) 2024, Rune Bjørnerås (https://github.com/rubjo)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Try

    ↑↓ selectEnter openTab filter

    Settings

    Theme
    Text
    Print

    Keyboard shortcuts

    / or Ctrl KSearch
    ↑ ↓ EnterPick a result
    TabNext result filter
    j kNext or previous entry
    [ ]Previous or next page
    yCopy a link to the current entry
    ?These shortcuts
    EscClose

    On this page