Skip to content

Keyboard use and accessibility

The chart supplies keyboard navigation, a visible focus ring and a textual series summary. The host supplies the platform accessibility bridge, surrounding controls and any additional data table its users need.

Use Tab to reach the chart and Shift+Tab to go backwards. Clicking or dragging it also requests focus when shortcuts are enabled; hovering alone does not. The focused chart keeps arrow keys for navigation. Tab and Shift+Tab continue through the remaining controls and out of the chart. Escape cancels the current interaction; it is not a substitute for Tab to leave the chart.

In a ChartLayout showing more than one chart, Tab and Shift+Tab move to the next and previous chart instead, wrapping at the ends, as do Shift+Right and Shift+Left while the active chart is not replaying. A host that needs them to leave the layout removes the CycleChartFocus and CycleChartFocusBack bindings through shortcuts_mut. If the host supplies a map through ChartLayout::set_shortcuts, remove the bindings from that map instead.

The presentation scene has egui controls before the chart in the native example. In the web guide, tab from Open full size into the canvas, then tab again to return to the guide. Shift+Tab returns to the preceding link. The embed reserves Tab for browser navigation, so its painted egui controls need pointer input. The full-size link also lets you explore without an embedded frame; web hosts needing keyboard-operable settings should supply equivalent HTML controls.

Default keyChart action
Left / RightScroll back / forward in time by pan_amount bars: Left shows earlier bars, Right later ones.
Ctrl+Left / Ctrl+Right (Command on macOS)Scroll back / forward in time by a page.
+ or = / -; Ctrl+Up / Ctrl+Down (Command on macOS)Zoom in / out using zoom_step.
Alt+RReset the chart view.
EscapeCancel an active interaction or selection.

KeyboardOptions is part of ChartOptions::keyboard. For a host that owns navigation:

use egui_charts::ChartBuilder;
let mut chart = ChartBuilder::new().build();
let mut options = chart.chart_options().clone();
options.keyboard.enabled = false;
chart.set_chart_options(options);

Disable chart shortcuts only when the host provides an accessible alternative. For custom keys, edit shortcuts_mut. Host dialogs should call suppress_shortcuts each pass while capturing keyboard input. Application actions such as symbol search are returned through take_shortcut_requests; the host must implement them. Keyboard pan and zoom do not provide a full keyboard equivalent for placing every drawing or inspecting every historical bar.

Chart::show reports a GraphicsDocument named for the symbol. Its text includes chart type, interval when set, bar count and timestamp range, then the hovered bar or latest valued bar with OHLC, volume and study readouts. Empty history and whitespace have explicit text. The translation lookup also supplies its names and message templates.

The summary currently uses RFC 3339 UTC timestamps and instrument price precision (two decimals when unspecified). It does not mirror the chart’s display zone or custom price/time/volume formatters. It is a summary node, not a navigable accessibility node for each candle. Provide a host data table or readout for detailed nonvisual historical inspection.

For a native eframe application, enable eframe’s accesskit feature in the host’s existing dependency to connect egui’s accessibility tree to the operating system. Enabling chart features alone does not install that bridge. A custom egui backend must supply its own accessibility integration; calling Context::enable_accesskit only enables tree generation.

On the web, the rendered chart is a canvas. The guide’s headings, links, source and example title are HTML and accessible to browser tools, but the canvas does not expose its painted candles or chart summary as an HTML table or ARIA tree. Do not assume the native accessibility opt-in makes that content available to a browser screen reader. Supply equivalent HTML controls and data readouts in the web host, and verify them with its supported browser and screen reader.

Use the guide’s theme picker to check light and dark reading. The running scene’s High contrast toggle applies Theme::high_contrast only to its chart. Custom colours still need contrast checks, and up/down colour alone should not carry information a user needs: retain OHLC text and labels. See host fonts for glyph coverage and replacement.

For an egui application, use Context::set_zoom_factor with 2.0 for a 200% check; 1.0 restores the default. This scales the egui UI, including chart text. Browser zoom scales the guide’s HTML separately from any host-defined chart typography. Allow sufficient chart height and use wrapping or scrolling for surrounding controls.

When integrating, check the complete flow at 200% and at a 390 px viewport:

  • Read headings, prose, source and scale labels in both themes; source blocks may scroll horizontally, while prose and controls should stay within the viewport.
  • Tab into the example, use arrows to pan, then tab out in both directions without a mouse. Confirm the focus indicator remains visible.
  • In the native host, confirm the chart’s name and latest values reach its screen reader; in the web host, confirm the equivalent HTML readout is reachable.