Simulating hover/focus on element

I think such cleverness isn’t necessary. Just handle the “Tab” key directly and do what you want. For example:

  $(go.Diagram, . . .,
    {
      "commandHandler.doKeyDown": function() {
        const e = this.diagram.lastInput;
        if (e.key === "\t") {
          // select and scroll to a random Node
          const nodes = new go.List(myDiagram.nodes);
          if (nodes.count > 0) {
            const node = nodes.elt(Math.floor(Math.random() * nodes.count))
            this.diagram.select(node);
            this.scrollToPart(node);
          }
        } else {
          go.CommandHandler.prototype.doKeyDown.call(this);
        }
      }
      . . .
    })