Inspector JavaScript console

Overview

The Console panel of the Inspector ends with a small JavaScript
console: a CodeMirror editor whose contents are evaluated in the inspected
page over the same CDP connection the log rows arrive on. It is the only
Inspector surface that is typed into, and it is designed for a phone first —
a soft keyboard, one hand, and a card that shares the screen with the log
above it.

The JavaScript console on a 430 px phone, three lines tall, with the indent button in its strip

Usage

  1. Open the Inspector tab, connect to a target, and switch on the
    Console panel.

  2. Type an expression in the editor below the log.

  3. Press Ctrl + Enter (or Cmd + Enter) to evaluate it in the
    page. The result is appended to the console log as a new row, sharing the
    log's stream, and the editor is emptied so the next entry starts clean.

document.querySelectorAll('.card').length

Enter inserts a newline; the evaluate shortcut is the modifier form. A
console entry is often several lines, and Enter is the one key a phone's soft
keyboard is guaranteed to have — so Enter belongs to the text, exactly as it
does in the chat composer. The desktop DevTools console evaluates on bare
Enter because it is typed on a hardware keyboard; that binding would make a
multi-line entry impossible on touch.

ActionBinding
EvaluateCtrl / Cmd + Enter
New line (indented)Enter or Shift + Enter
IndentTab, or the strip's ↵ button
AutocompleteCtrl + Space, or just type
Recall the previous entry↑ / ↓

The editor is one line tall when it is empty and grows with what has been
typed, up to about a third of the viewport; beyond that it scrolls. The strip
carries a single ↵ button — the newline-with-indent a soft keyboard cannot
type — beside the hint.

Autocomplete

Suggestions come from three layers, merged into one picker:

Behavior