MAIDR JavaScript API
    Preparing search index...

    Class Controller

    Main controller class that orchestrates all services, view models, and interactions for the MAIDR application.

    Implements

    Index

    Constructors

    • Initializes the controller with all necessary services, view models, and bindings.

      Parameters

      • maidr: Maidr

        The MAIDR configuration object containing plot data and settings

      • plot: HTMLElement

        The HTML element containing the plot to be made accessible

      • store: EnhancedStore

        The Redux store instance for this plot's state management

      • session: ControllerSession | null = null

        What the reader had when they last left this chart, to put back before anything is built on the model

      Returns Controller

    Methods

    • Picks up where the reader left off: reopens braille if it was open and announces the point they are back on, the way a move to it would.

      Runs once, on the focus-in that built this controller, in place of the initial instruction -- a reader coming back needs to know where they are, not how to start.

      Returns boolean

      False when there is no position to resume, and the caller shows the initial instruction instead

    • Displays the initial instruction in the text view without announcing it to screen readers.

      Returns void

    • Moves the reader to a position the host chose -- the mark a sighted user clicked in the host's own chart.

      The target is checked before anything is touched: a position the figure does not have is refused with the delta layer, the grid cell and the rotor mode all exactly as they were. Only then are the modes that re-route the arrow keys left, the way a data update leaves them -- the candlestick delta layer closed silently, a rotor mode (grid, point, intersection) reset to data mode, since the target is spelled in the trace's data coordinates and would land somewhere else read through a mode's own cursor -- and the model does the move and announces the landing point once.

      Parameters

      Returns boolean

      True when the cursor moved there; false leaves everything as it was

    • Whether the reader is somewhere a keyboard move to another point is not available -- a MAIDR dialog (chat, settings, help, the command palette, go-to-extreme, the object list), the braille or review field, or a label chord.

      navigateTo leaves only the modes that re-route the arrow keys (grid cell, candlestick delta, rotor); it does not close a dialog, and a move made under one switches the keyboard scope out from beneath it. A caller acting on its own schedule, such as an in-browser agent, asks this first.

      Returns boolean

      True while such a scope is active

    • Runs one of the reader's commands for a caller acting on its own schedule, such as an in-browser agent.

      Goes through the executor the command palette uses, in the scope the reader is in, so it does what their key would do there -- an arrow move stops autoplay first, as the arrow keys do -- and nothing where that key does nothing.

      Parameters

      • command: never

        The keymap's name for the command

      Returns "unavailable" | "now" | "blocked"

      now when it ran, unavailable when the reader's scope has no key for it or the key would silently do nothing there, and blocked while isCommandBlocked

    • Whether the reader is in a MAIDR dialog, a text field or a label chord, where runCommand refuses.

      Unlike isNavigationBlocked, the braille field does not count: it is where a braille reader reads the chart from, and its own keymap decides which commands run there.

      Returns boolean

      True while such a scope is active

    • The modes a controller built from a session would have once it resumed, for a caller asking while no controller is alive.

      Monitoring, autoplay and the rotor mode are not carried over, so a new controller always starts them off and in data mode; high contrast is a saved setting. Braille comes back where resume reopens it: on the reader's point, or, with no point to return to, on the first layer a one-panel figure starts on -- not on the overview of several panels.

      Parameters

      • session: ControllerSession | null

        What the reader had when they left, or null

      • maidr: Maidr

        The data the next controller is built from

      Returns LiveReaderModes

      The modes the next controller starts with

    • The text the reader's screen reader last spoke for their position -- the point, its axis labels and values -- as the text mode renders it.

      Read-only: asking changes nothing and announces nothing.

      Returns string | null

      The position text, or null before the reader has landed on a data point

    • Initialize high contrast mode if enabled in settings. Call this after the Controller is fully set up and will persist (not the throwaway init).

      Returns void

    • Suspend high contrast mode visually (restore original colors). Call this on blur to return the chart to its original appearance.

      Returns void

    • Replaces the chart data in place (live/realtime update).

      Rebuilds the model layer (Figure/Subplot/Trace) from the new data while preserving the user's navigation position, then rewires all observers. Services, view models, and keybindings are untouched, so the update is cheap enough for streaming scenarios.

      The swap itself is silent; when monitor mode is enabled and the update appended a point, that point is sonified and announced without moving the user's position.

      Parameters

      • maidr: Maidr

        The complete replacement MAIDR config (caller-owned copy)

      • Optionalappended: AppendedPointInfo

        Location of the newly appended point, for appendData updates

      Returns void