Class AriaCommandHandler

GoJS® Diagramming Components
version 3.0.2
by Northwoods Software®

This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. See the Extensions intro page for more information.


This custom CommandHandler is an example of how screen reader accessibility can be added to diagrams with an aria-live DIV.

This CommandHandler adds more key commands for a user:

  • Arrow keys: Change selection to a new node, if possible, based on direction. This is added to an internal navigation history.
  • b: Give a description of which nodes are adjacent to the currently selected node
  • x: Go backwards in the navigation history
  • c: Go forwards in the navigation history

This custom CommandHandler is meant as a starting point to create a more individualized CommandHandler for your unique use case. Certain data and attributes of nodes that are different between diagrams may be important to the accessibility interpretation. When describing a Part, this example calls getPartText, which uses the Part.text if it is specified, otherwise the Part.key. You'll want to modify this to suit your needs.

If you want to experiment with this extension, try the Accessibility sample.






  • Clears the text on the aria region and sets it to the passed message.


    • message: string

      the string to read

    Returns void

  • Checks for a node in each direction and build a message to be called based on if there is and which nodes are around the currently selected one

    Returns void

  • This implements custom behaviors for arrow key keyboard events. to affect the behavior when the user types an arrow key.

    Returns void

  • Given a Part, return the text that the aria label should read By default this uses Part.text, unless it is empty, then it uses Part.key This can be overridden to return arbitrary text based on Part data, etc.


    Returns string