# Keyboard navigation

> Use single-key shortcuts and understand when typing disables them. Disable shortcuts for the site or individual pages.

---

LLMS index: [llms.txt](/llms.txt)

---

Your readers can work through your documentation without reaching for the
mouse: every interactive OINK page answers twenty-nine single-key shortcuts, ten
for moving around, nine for acting on the page and ten for changing the view.
Press \' on any page to see all twenty-nine; keys the current page
cannot use are dimmed. Shortcuts are on by default, step aside whenever the
reader is typing, and can be [turned off](#disable) for a site or a page.

## Navigation {#navigation}

| Key | Action |
| --- | --- |
| W S | Move to the previous / next entry of the sidebar tree |
| A D | Collapse / expand the section |
| Enter Space | Open the focused tree entry |
| Q E | Previous / next page in sidebar order |
| K J | Previous / next heading of the page outline |
| X | Switch to the next language |
| R | Switch to the next top-level section |
| V | Switch to the next version |
| H | Open the browsing history |
| G | Go to the home page |

### Sidebar tree {#sidebar}

The tree keys work on every page with a sidebar tree, and you do not have to
enter the tree first: with focus in the article, S moves from the
current page's entry to the next one in a single press. The focused row is
tinted one step darker than the current-page row, so "where I am" and "where
the cursor is" stay distinguishable. When the sidebar sits in the phone drawer
or is collapsed on desktop, the first press opens it.

Once focus is in the tree, ↑ ↓ ←
→ work like the letters; in the article the arrows keep native
scrolling. In a right-to-left language ← and →
follow the reading direction, while A always collapses and
D always expands.

From a page entry, A first moves to the parent section and a
second press collapses it. D opens a collapsed section, or steps
into its first visible child when it is already open. Sections without a page
of their own take focus through their disclosure button, which
Enter or Space toggles. Esc leaves the
tree and returns focus to where it was.

### Reading {#reading}

K and J visit the same targets as the right-hand
outline and land where an outline click would. Every jump takes 100 ms however
far it goes, and you can press again before it finishes. Deep inside a section,
K first returns to that section's start. A page without headings
scrolls a short step instead. On the home page the two keys move between the
landing sections.

Q and E follow the order the sidebar shows, not
dates, and skip collapsed branches, so paging and tree focus always agree. A
section's index page is an entry of its own: at a blog boundary the order runs
from the last post of one section to the next section's index, then to its
first post. Without a sidebar tree, paging uses the page-end pager, then the
`rel="prev"` and `rel="next"` links in `<head>`.

### Language, section and version {#switching}

These keys work on every interactive page and do nothing when there is no
other choice:

- X switches to the next language, wrapping after the last one.
  It opens this page's translation, or that language's home page when the page
  has none.
- R cycles through the same-origin top-level navbar entries. It
  skips external links and the navbar's utility controls.
- V opens the next version listed in `params.versions` that has a
  URL, wrapping after the last one.

### Browsing history {#history}

H opens a search-style list of the pages you have read on this
site, newest first. The page you are on is left out, so H then
Enter takes you back to the previous page.

| Key | In the history list |
| --- | --- |
| Typing | Filter by title and path; every word must match |
| ↑ ↓ | Select an entry |
| Enter | Open it; Ctrl + Enter (⌘ + Enter on macOS) opens it in a new tab |
| Shift + Delete | Remove the selected entry |
| Esc | Close the list |

**Clear history** removes all stored visits, including the current page. The command palette also offers
a **Browsing history** command that opens the same list.

History keeps the last 100 pages in this browser's `localStorage`, under a key
named after the site's base path, such as `td-history:/`. Every language of the
site shares one list, and two sites on the same domain keep separate ones. OINK
never sends it anywhere. It is recorded only on pages where keyboard navigation
is on, and there is no separate switch for it.

G opens the home page of the current language. On the home page
itself it scrolls back to the top.

## Actions {#actions}

| Key | Action |
| --- | --- |
| \/ F | Search |
| \\ C | Open the command palette with commands only |
| U | Edit this page |
| N | Create a child page |
| I | Create a docs issue |
| O | Expand or collapse everything that folds |
| P | Print this page |
| \[ | Open in ChatGPT |
| \] | Open in Claude |

### Search and commands {#search}

\/ opens the [command palette](/docs/customize/panel/) ready to
search, and \\ opens it with commands only.
Both keys belong to the palette, so they keep working when keyboard
navigation is off; F and C are the keyboard
navigation equivalents. ⌘ + K on macOS and Ctrl + K
elsewhere open the palette from anywhere, even a text field, and close it
again. On layouts where \\ is hard to reach, press C
or type `>` at the start of the search box.

The palette needs local search (`params.offline_search: true`); without it
these four keys do nothing.

### Page actions {#page-actions}

U, N and I run the same actions as the
page menu beside the title and open their target in a new tab. All three need
a [repository](/docs/customize/repository/) configured for the site;
U and N also need a page with a source file, so
they do nothing on generated pages such as tag lists. P prints
the page, exactly like the browser's print command.

\[ and \] hand the page to ChatGPT or Claude in a new
tab. They work only when the site enables
`params.ui.page_context_menu.assistant_links`.

### Expand or collapse all {#expand-all}

O opens everything on the page that folds: the sidebar sections,
the right-rail groups (outline, backlinks, term clouds), collapsible callouts,
file trees, "show more" lists and long code blocks. When everything is already
open, it folds all of them instead, except the sidebar branch of the current
page, so you never lose your place. The line you are reading stays where it is
while the page above it grows or shrinks.

Menus and popovers such as navbar dropdowns are not folded content and stay
closed. Collapsed rails stay collapsed; restore them with their own buttons.

## View {#view}

| Key | Action |
| --- | --- |
| B | Open or close the Duo View |
| Z | Turn Zen Mode on or off |
| M | View the page's Markdown source |
| T | Switch to the next visual style |
| Y | Switch color mode: light, dark, system |
| L | Switch the index layout: list, cards, table, gallery |
| \; | Switch the gallery layout: wall, cards, seamless |
| \, \. | Smaller / larger gallery images |
| \- \= | Narrower / wider reading column |
| \' | Open or close the shortcut help |

### Zen Mode and Duo View {#zen}

Z hides the navigation shell so only the text remains: the
navbar and footer on the home page, and also both rails and the floating
buttons on documentation pages. The choice lasts for the browser tab and is
restored before the first frame, so paging with Q
E keeps it without a flicker. At phone width the top bar stays,
because it is the only way back to the navigation. While the shell is hidden,
the tree keys do nothing.

B opens the [Duo View](/docs/customize/i18n/#bilingual-view) when
the site sets `params.ui.compare: true` and the page has a translation, and
closes it again from either pane.

M opens the page's Markdown output in a new tab on sites that
publish it.

### Appearance {#appearance}

T steps through the visual styles the site offers in
`params.ui.preset_menu` and wraps after the last one; it does nothing when the
site offers a single style. Y steps through light, dark and
system color modes and does nothing when the dark palette is off
(`params.ui.dark_mode` disabled). Both work
on every interactive page and remember the choice like the Appearance menu does.

### Index and gallery layouts {#layouts}

On blog, release and case index pages with `params.ui.blog_index_toggle`,
L cycles the index through list, cards, table and gallery. On an
[Expo album](/docs/write/expo/#shortcuts), and on an index while its
[gallery view](/docs/write/blog/#list-gallery) is showing, three more keys
control the grid:

| Key | Gallery action |
| --- | --- |
| \; | Cycle the layout: wall, cards, seamless |
| \, or \< | Shrink the target image size by 20 px, down to 160 px |
| \. or \> | Enlarge the target image size by 20 px, up to 360 px |

The toolbar follows each change, the grid reflows at once, and the choice is
remembered: `td-expo-mode` and `td-expo-size` for Expo albums,
`td-blog-gallery-mode` and `td-blog-gallery-size` for index galleries. Clicking
a layout icon or dragging the size slider does not stop these keys.

### Page width {#page-width}

On wide screens the reading column keeps its page width even when the window
has room to spare. \- and \= (or \+)
narrow and widen it by 100 px at a time on documentation, book, blog and Expo
pages:

- The column never gets narrower than 600 px and never wider than the space
  between the rails. Widening until it touches the rails makes it fill that
  space on any screen size.
- The width applies to every page of the site in this browser and is restored
  before the first frame. It replaces each page's `page_width` and the Book
  content measure. Printing ignores it.
- A step that reaches the page's own width stops there and forgets the stored
  width (`td-shell-article-w` in `localStorage`), so stepping back always
  returns every page to the width its author chose.

### Expo viewer {#expo-viewer}

An Expo image opens in a viewer with its own keys for moving, zooming and
changing images, listed in the [Expo guide](/docs/write/expo/#shortcuts). Page
shortcuts pause while the viewer is open and resume when it closes. The viewer
keys work even when `keyboard_nav` is off.

## Shortcut help {#help}

\' opens all twenty-nine shortcuts in a centered dialog: navigation,
actions and view side by side (ten, nine and ten rows). Rows the current page cannot run
stay in place but are dimmed, and screen readers hear them as unavailable, so
the grid keeps the same shape everywhere. The dialog opens from anywhere: in
the middle of a long page, in Zen Mode, or on pages without a footer
(`footer_style: none`). \', Esc, the close button or
a click outside the dialog closes it.

The question-mark button at the end of the footer's bottom bar offers the same
sheet. Hovering or focusing it previews all twenty-nine shortcuts directly
above the footer (three columns side by side on wide screens, wrapping cleanly
on narrower screens), with unavailable rows already dimmed; clicking it opens
the centered modal dialog with the **Enable shortcuts** toggle, and closing the
dialog returns focus to the button.

With keyboard navigation off and local search on, the button keeps only the
two palette keys, \/ and \\, and opens no dialog.

## Keys left free {#reserved}

\? and the digits are deliberately unbound, and modified letters keep their usual meaning except for the exact search chord
Ctrl + K or ⌘ + K. Use the character printed by
your keyboard layout. For example, German Shift + 7 opens search.
The gallery and width keys also accept Shift to produce `,`, `.`, `;`, `<`, `>`, `=` or `+`.

## When shortcuts stand down {#stand-down}

Every binding is a single key, so each one steps aside when it could collide
with typing or an overlay:

- Focus is in a text field: `<textarea>`, `<select>`, `contenteditable`, or an
  `<input>` you type into, such as text, search, email, password or number.
  Non-text controls such as gallery layout radio buttons and the size slider
  keep the page shortcuts and their own arrow keys.
- Focus is inside a map or an audio or video player, which keeps its
  own keys.
- An input method is composing, which matters on every Chinese, Japanese or
  Korean site.
- A modifier key is held. ⌘ + C still copies,
  Shift + M does nothing, and Shift + ↓ stays a
  browser action.
- The command palette, the browsing history, the shortcut help, the Expo
  viewer, another open dialog or a visible ARIA dialog owns the keyboard.
  Hidden ARIA dialogs do not block shortcuts.

Comments load in an iframe, so their keystrokes never reach the page.

## Focus order and accessibility {#a11y}

- **Skip link**: the first Tab on a page reveals "Skip to
  content", which passes the navbar and sidebar in one step and marks the
  article title.
- **Real focus**: tree navigation moves the actual DOM focus, so a screen reader
  announces the link name and its "current page" state, Enter
  keeps the link's native behavior, and the Tab order is unchanged.
- **Hidden content**: a collapsed sidebar or closed drawer leaves the Tab order,
  while the button that restores it stays reachable. Clicking the article, a
  table or a code block does not leave a large outline behind for the next key.
- **High contrast**: under `forced-colors` the focused row and the selected
  history entry are outlined in the system highlight color.
- **Reduced motion**: with `prefers-reduced-motion`, heading jumps and paging
  land instantly.
- The keycaps in the shortcut help are the same as the
  [Kbd](/docs/components/kbd/) component you write in pages.

## Turning it off {#disable}

To turn off single-key shortcuts for yourself, open shortcut help and uncheck
**Enable shortcuts** (enabled by default). At the start of any page with these shortcuts, Tab
past **Skip to content** to reach the same checkbox. This also works on pages
without a footer. Space toggles the checkbox. Your choice applies across the
site’s languages in this browser. Ctrl+K or ⌘K still opens the search palette.

Site-wide:

```yaml {title="hugo.yml"}
params:
  ui:
    keyboard_nav: false
```

For one page, such as an interaction-heavy demonstration, or for a whole
section through `cascade`:

```yaml {title="content/docs/playground.md"}
---
title: Interactive playground
keyboard_nav: false
---
```

The key takes a boolean only; see [Configuration](/docs/customize/config/) for
the complete definition. A page with keyboard navigation off ships no keyboard
runtime at all: no shortcuts, no browsing history recording and no restored
page width. \/, \\ and ⌘ + K belong to
search and keep working, and the footer's collapse arrow is unaffected.

## Verify {#verify}

Build your site, then replace `public/docs/getting-started/index.html` below
with a documentation page your site actually generates, including any language
prefix.

1. Confirm that the help button is in the page:

   ```bash
   hugo --printPathWarnings
   PAGE=public/docs/getting-started/index.html
   test -f "$PAGE" && grep -c 'td-shell-keyboard__trigger' "$PAGE"
   ```

   With keyboard navigation off and no local search, the button is not
   generated.

2. Open a documentation page and press \': three columns
   appear, with dimmed rows for features this page lacks. Press it again to
   close the dialog.
3. With focus in the article, press S a few times. The sidebar
   focus moves down from the current page and the article stays still. Then
   press E and check that pages follow the sidebar order.
4. Read two pages, then press H and Enter: you are
   back on the first one.
5. Press O twice. Every sidebar section opens, then everything
   folds again except the branch of the current page.
6. On a wide window, press \= and \-. The column
   widens and narrows, and keeps its width after a reload.
7. Click in the search box and press J. The letter is typed and
   the page does not scroll. Repeat with an input method.

## Related {#related}

- [Command palette](/docs/customize/panel/): the dialog behind \/, F, \\ and C
- [Search](/docs/customize/search/): where the palette's page results come from
- [Layouts and page types](/docs/customize/layout/): which pages have a sidebar and an outline, and so which keys apply
- [Kbd](/docs/components/kbd/): writing keycaps in your own pages
- [Configuration](/docs/customize/config/): the complete definition of `ui.keyboard_nav`

---

Backlinks:

- [Navigation, search and languages](/book/09-navigation/)
- [Highlights](/docs/about/features/)
- [Upgrade](/docs/admin/upgrade/)
- [Kbd](/docs/components/kbd/)
- [Update](/docs/components/update/)
- [Customization](/docs/customize/)
- [Configuration](/docs/customize/config/)
- [Navigation and menus](/docs/customize/navigation/)
- [Command palette](/docs/customize/panel/)
- [Search](/docs/customize/search/)
- [Keyboard map](/docs/design/decisions/keyboard-map/)
- [Page parameters](/docs/write/frontmatter/)
