Skip to main content

Keyboard shortcuts

Every shortcut is declared once, in src/lib/shortcuts/catalogue.ts — its combo, label, description and group. useShortcuts (src/lib/hooks/useShortcuts.ts) binds one document-level keydown listener per chart instance and dispatches from that catalogue; the Settings → Hotkeys panel and the in-chart ? help panel both render from it too.

The catalogue derives a ShortcutId union, and SuperchartComponent supplies handlers as a Record<HandledShortcutId, …>. Adding a catalogue entry without a handler fails to compile, and so does a handler for an id the catalogue doesn't list — so the list users see and the keys that actually work cannot drift apart.

Press ? on the chart to see the live list.

Currently registered​

The mapping follows TradingView's keys. A function TradingView also has moved to its key and the old one was dropped, with no alias; functions only Altrady Charts has keep theirs, except where TradingView needs the key (interval stepping, channel, replay).

KeysActionFires when
Delete / BackspaceDelete selected drawingA drawing is selected
Ctrl/Cmd + C / XCopy / cut selected drawingA drawing is selected — via the native copy / cut events, not the registry
Ctrl/Cmd + VPaste (image, text or drawing)Always — via the native paste event
Ctrl/Cmd + ASelect all drawingsAlways
Ctrl/Cmd + ZUndoAlways
Ctrl/Cmd + Shift + ZRedoAlways
Ctrl/Cmd + SSave chart layoutAlways
EscCancel drawing in progress, else deselectAlways
?Show this list on the chartAlways

The clipboard keys are native events so they follow the platform's own key and the OS clipboard. They are skipped when focus is in a text field, and copy/cut only claim the event while a drawing is selected, so copying page text still works.

KeysAction
← / →Scroll one bar; nudges the selected drawings instead when any are selected
↑ / ↓Nudge the selected drawings (no zoom)
Alt + ← / Alt + → (and Ctrl + ← / → off macOS)Scroll continuously while held
Alt + Shift + ← / →Jump to the first / latest bar
Ctrl/Cmd + ↑ / ↓Zoom in / out
,Open the interval entry, empty
Alt + , / Alt + .Previous / next interval
0–9Start typing an interval — 15 ⏎, 4h ⏎, 1d ⏎
A–ZOpen symbol search, seeded with that letter
Alt + ZKeyboard navigation of the toolbars

View​

KeysAction
Alt + RReset both scales — default bar spacing at the latest bar, price axis back to auto-scale
Ctrl/Cmd + Alt + QReset the time scale only
Alt + STake a snapshot (preview dialog)
Ctrl/Cmd + Alt + SDownload a screenshot (PNG)
Ctrl/Cmd + Shift + SCopy a screenshot to the clipboard
Alt + IInvert the price scale
Alt + LLogarithmic price scale
Alt + PPercentage price scale
Alt + Shift + TNext chart type
Shift + FFullscreen

Logarithmic and percentage select one of the engine's registered y-axes (extension/y-axis/), each a real value↔pixel transform. Pressing the same key again returns to normal. indexed100 has no axis in the engine and so has no key; scales.autoScale is still persisted but unapplied.

Alt + Z moves focus into the top bar, then the drawing rail; pressing it again steps to the next bar and finally back to the chart. Inside a bar the arrow keys (and Home / End) walk its buttons, Enter / Space activate one and Esc returns to the chart.

Mouse and modifiers​

Listed in the ? panel under "Mouse" so they are discoverable; the engine implements them, not the registry. Ctrl/Cmd-drag clones a drawing, Ctrl/Cmd-click toggles multi-selection, Ctrl/Cmd-drag on empty chart marquee -selects, Shift-click measures, double-click maximizes a pane (with Ctrl/Cmd, collapses it), Ctrl/Cmd-wheel zooms at the cursor, Shift-wheel scrolls horizontally, the wheel over the price axis zooms the price scale only, middle-click deletes a drawing, and Shift / Ctrl/Cmd held while drawing or dragging snap, constrain or invert the magnet.

Type-ahead​

Typing on the chart does something useful rather than nothing. A digit starts an interval — a hint appears showing what you have typed, and Enter applies it. 15 is fifteen minutes, 120 is two hours (exact multiples of 60 are promoted, as everywhere else), 4h four hours, 1d a day, 2w, 3M. Backspace edits the entry, Escape abandons it, and it clears itself after a couple of seconds of inactivity. An entry that is not yet a valid interval is shown muted, so 0 reads as wrong before you press Enter rather than after.

A letter opens symbol search seeded with it, so finding a ticker is one keystroke rather than a click into a modal. A bare D is therefore symbol search, not the daily interval — type 1d for that.

This is not a useShortcuts entry: the registry matches fixed combos, and this consumes a stream of characters. It has its own listener obeying the same rules (nothing while focus is in a text field; anything with Ctrl/Cmd/Alt is left for the combo shortcuts). Escape and Backspace mean something to both systems, so while an entry is pending they belong to the type-ahead — Backspace edits the buffer instead of deleting the selected drawing.

, opens the same entry with nothing typed (TradingView's interval dialog) and a bare unit letter such as D is then accepted; Esc or a few seconds of inactivity closes it. A capital letter that is also a shortcut (Shift + F) is left to the shortcut rather than opening symbol search.

Interval stepping (Alt + , / Alt + .) walks the same ladder the period bar is showing — the host's periods, or the built-in fallback — so the keyboard and the bar always agree on what "next" means. It clamps at each end rather than wrapping: running off the top and reappearing at 1m would be a surprise, not a convenience.

← / → scroll exactly one bar. Holding Alt + ← / → runs a frame loop that scrolls by elapsed time, so the speed does not depend on the OS key-repeat rate. Zoom out is the reciprocal of zoom in, not 1 − step, so zooming in and back out returns you exactly where you started instead of drifting wider each time.

Selecting drawings​

Click selects one. ⌘/Ctrl-click adds or removes another, and Ctrl/Cmd + A selects every drawing on the chart; Delete then removes all of them at once. The object tree uses the same gesture.

The selection lives in the engine, not in this library: OverlayView collapses to the clicked drawing on a plain click, extends on ⌘/Ctrl-click, repaints the selected drawings, and prunes ids as overlays are removed. It also supports a marquee sweep. Altrady Charts mirrors the engine's onSelectedOverlaysChange action into a store signal so React can subscribe, and writes back through it — it does not keep a selection of its own.

selectedOverlay remains the primary selection, which is what the floating toolbar points at and what single-target actions use; the mirrored id set is what bulk actions read.

Panels​

KeysPanel
/ (or numpad /)Indicators
.Load layout
Ctrl/Cmd + ,Settings
Ctrl/Cmd + KSymbol search
Alt + EScript editor
Alt + OObject tree
Alt + DDrawing toolbar
Alt + Shift + PReplay
Alt + GGo to date

Alt plus the panel's own initial where one was free; search and preferences keep the combos they have everywhere else. Alt + E is bound only when a ScriptProvider is configured — with no editor to open, a key that silently does nothing is worse than one that isn't bound. Alt + Shift + P is likewise bound only while the replay feature flag is on (default true); with it off, the key does nothing and its row is left out of the Hotkeys list and the ? panel — see docs/features.md.

Every shortcut that opens a flag-gated piece of UI follows the same rule, keyed to the flag that hides its entry point: Alt + S / Ctrl/Cmd + Alt + S / Ctrl/Cmd + Shift + S on screenshot_button, Ctrl/Cmd + , on settings_button, Ctrl/Cmd + K and letter type-ahead on symbol_search, / on indicator_picker, . on multi_chart_browser, Alt + E on script_button, , / Alt + , / Alt + . and digit type-ahead on period_picker, Alt + M on crosshair_magnet, and the drawing tools, rail toggles and Alt + D on drawing_bar. Undo, delete and the like are never gated, and neither is Shift + F: as in TradingView, fullscreen works with its button hidden.

While a dialog, menu or listbox is open (focus inside it, or any aria-modal dialog open), the registry and type-ahead stand down so /, ., arrows and the rest don't act on the chart behind it; Esc still closes the dialog.

Drawing tools​

KeysTool
Alt + TTrend line
Alt + FFib retracement
Alt + Shift + RRectangle
Alt + HHorizontal line at the cursor
Alt + JHorizontal ray at the cursor
Alt + VVertical line at the cursor
Alt + CCross line at the cursor
Alt + Shift + CParallel channel
Alt + BBrush

The four "at the cursor" tools place the drawing immediately at the crosshair through the same path the rail uses (same groupId, persistence and undo). With the pointer off the chart there is no position, so they arm the tool instead.

Rail toggles, grouped with the tools you reach for at the same time:

KeysAction
Alt + MMagnet (snap to OHLC)
Ctrl/Cmd + Alt + HHide / show all drawings
Alt + Shift + HHide / show drawings and indicators
Alt + KStay in drawing mode

These four pieces of drawing-bar state — magnet mode, drawing visibility, indicator visibility and stay-in-drawing-mode — live on the chart store rather than inside DsDrawingBar. A shortcut that only told the engine would leave the rail's own icon showing the opposite state, so the store is the single value both read.

These follow TradingView's assignments. Each arms the tool exactly as clicking the drawing rail does — same groupId — so keyboard-armed drawings are grouped with rail-armed ones for "remove all drawings" and in the object tree.

The Settings → Preferences → Hotkeys panel and the ? overlay both render from the catalogue, so adding a shortcut there is all it takes for both to list it.

Writing a shortcut​

{
key: 'Mod+Z', // 'Mod' = Ctrl on Windows/Linux, Cmd on macOS
when: () => cond(), // optional gate, evaluated at fire time
handler: () => {
doTheThing()
return true // true → event.preventDefault()
},
description: 'Undo', // shown in the Hotkeys panel
allowInInput: false, // default: skipped while focus is in a text field
}

Modifier order is Mod → Alt → Shift, and single characters are case-insensitive.

Typing beats shortcuts, by design​

A shortcut is skipped when focus is in an <input>, <textarea>, <select> or a contenteditable element, unless it opts in with allowInInput: true. Use that sparingly — Escape is the usual case.

This has a consequence worth knowing when testing: several drawings open the engine's inline text editor the moment they are placed, so immediately after drawing a trend line the focus is in a real <textarea> and Ctrl+Z correctly goes to that text box rather than to the chart. Click away or press Escape first. This is not a bug — while the caret is in a text field, undo belongs to the text.

Reserving keys for the host​

A host that owns some key combos itself (Altrady's own keymap, say) can reserve them so Altrady Charts never acts on them:

const sc = new AltradyCharts({ /* ... */, reservedKeys: ['Mod+ArrowUp', 'Shift+B'] })
sc.setReservedKeys(next) // replaces the whole set; [] clears it
  • Syntax is the catalogue's: +-joined tokens, key last. Ctrl, Control, Cmd and Meta are aliases of Mod; modifier order and letter case are free, so shift+ctrl+z equals Mod+Shift+Z.
  • A reserved combo is skipped by the shortcut registry (no handler, no preventDefault), by type-ahead (even while 4 is pending, so 4 then reserved Shift+D leaves 4 pending), and by native copy / cut / paste when Mod+C / Mod+X / Mod+V is reserved.
  • Rows for reserved keys are hidden from the ? panel and Settings -> Hotkeys. Both read the set when they open, so an open list keeps its rows until reopened.
  • Per chart. Mouse actions (wheel, middle-click, Shift+click) are not covered.

Undo / redo​

Scope is drawings and indicators only. Preferences, styles, chart templates and favourites are not undoable: nobody expects Ctrl+Z to revert a timezone, and silently reverting one would be worse than not undoing it.

Mechanically, every overlay and indicator mutation funnels through enqueueMutation in useChartState, which holds both the before and after ChartState. ChartHistory records that pair, and undo applies the difference back onto the live chart (applySnapshotDelta) rather than rebuilding everything, so a step does not flicker or drop selection.

Consecutive edits to the same single drawing within 600 ms coalesce into one step, so a drag is one Ctrl+Z rather than forty. Anything that adds or removes a drawing never coalesces, so a delete can't be swallowed by the drag before it.

The stack holds 100 steps and is per chart instance. Applying a template or restoring saved state does not record history.

Host-side:

await sc.undo() // false when there was nothing to undo
await sc.redo()
sc.canUndo() / sc.canRedo()

Deliberately unbound​

  • Remove all drawings — destructive and irreversible from the keyboard.
  • Indexed-to-100 scale, auto-scale — indexed100 has no registered y-axis in the engine, and autoScale is persisted but unapplied, so a key would be a no-op. Logarithmic and percentage are now bound.
  • Alerts — no alert feature behind the top bar's showAlerts={false}.