The controller’s Guide button always opens ejGames’ quick menu. F5, F11, Ctrl + F,
Ctrl + , , Ctrl + P and Ctrl + K are launcher shortcuts and do not reach your
theme as actions.
You do not have to work out what is above or to the right. The kit has
spatial navigation in
focus.js.
-
Mark everything that can be chosen with
data-focus. The two buttons in the bar already have it in the HTML. Add it to the card and to the empty library button: -
Create the focus and connect it to the actions. Add this at the top of
main.js:and, afterready(): -
Show the focus in CSS. The focused element has the class
is-focused: -
Make sure something is always focused. At the end of
pintar(), afterkeyed(…):withconst idEnfocado = foco.current?.dataset.id;at the start ofpintar().
bindNav(focus, { action: function }): the arrows move focus andacceptclicks the focused element (with its sound). Your functions run first. If one returnsfalse, the action is not treated as handled. Forback, that means ejGames handles it (it closes whatever it has open and, in Big Picture, opens the quick menu).foco.currentis the focused element.foco.focus(el)focuses a specific one andfoco.first(container)focuses the first in a container. With{ silent: true }it makes no sound, and with{ noScroll: true }it does not scroll.ejg.game.favorite(id)toggles the favorite (or sets it if you passtrue/false). You do not need to repaint by hand: the change arrives throughlibrary.onChangeand the card updates itself.data-focus-group(on#rejilla) remembers the last focused element of the group. If you go up to the bar and come back down, you return to the same cover.- With the mouse, passing over an element focuses it, and leaving removes the mark, so it does not stay stuck. With a controller the cursor is hidden.
The hint bar
hints() draws the controls with the symbols of the device in use: A B X Y with
an Xbox controller, ✕ ○ □ △ with a PlayStation one, Enter, Esc, E, F with a
keyboard. It changes on its own when you change device:
pistas.set([...]). The <html> element
carries data-input="mouse|keyboard|gamepad", so hiding the bar with the mouse
is pure CSS:

