focus

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package focus demonstrates a screen with multiple components sharing one keyboard, using pkg/focus to decide which of them has it.

A focus.Group holds the components in tab order and owns three things a hand-rolled index cannot do as well:

  • tab / shift-tab cycling, including the blur-everything-focus-one dance
  • granting focus to a component that was clicked, since the click arrives at the component rather than at the screen that knows the ordering
  • answering IsCapturingKeys from whichever component currently has focus
  • describing every pane's bindings for the key overlay (HelpSections), grouped and titled by pane rather than merged into one flat list

The screen still routes messages itself, because focus is about the keyboard and not about content: keys go to the focused component only — otherwise typing in the query would also drive the list's cursor — while mouse events go to every component, so each can test the click against its own rect and claim it if it landed inside.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(t theme.Theme) screen.Screen

New returns the focus demo's root screen.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL