Hi Team, We use GoJS 3.x and override commandHandler for accessibility. We are maintaining the current selected node/link in that code without depending upon diagram selection. This is the code which we are using to achieve the a11y - Need more insight on a11y / accessibility - #23 by walter .
Here, we have contextMenu which will be triggered to Open & close when we click on escape. Using the below code to close the contextMenu:
if (goDiagram && goDiagram.currentTool instanceof go.ContextMenuTool){ goDiagram.currentTool.doCancel(); }
Once contextMenu gets closed, the focus is missing. I tried to put back focus on the diagram, but that will start accessing elements from the start of the diagram.
What did you do when you “tried to put back focus on the diagram”? Did you not remember what element had focus before the context menu was shown?
ContextMenuTool.currentObject tells you the GraphObject for which the context menu was shown – presumably you would want to “focus” on that GraphObject again.
And presumably you are calling Diagram.focus so that the diagram gets HTML DOM keyboard focus, Diagram | GoJS API
[EDIT] OK, I just our latest version of the Keyboard Navigation sample KeyboardCommandHandler, with a node’s context menu button that explicitly changed focus to a <textarea> element on the page. Invoking that context menu button did change focus to that texture, so I found myself typing in that texture. Then hitting Shift-Tab a couple times put the HTML DOM’s keyboard focus back in the Diagram, so that arrow keys changed the GraphObject “focus” within the diagram.