I am attempting to make use of the HyperlinkText.js extension in my code to create a hyperlink, I wanted to know if it is possible to make this hyperlink focusable via keyboard “tab” like other “nodes”. If yes, then what is the suggested way to achieve this behaviour?
Could you please be more specific and descriptive about the effects of Tab and focus that you want to achieve?
Sure essentially, I am looking to add a few hyperlinks to my diagram (which I have been able to achieve via the HyperlinkText.js extension). What I am trying to achieve next is keyboard accessibility i.e the user should be able to tab to various portions of the diagram by tabbing much like they would be able to do in an HTML page. Currently it is possible to navigate to some of the “Node” components of the diagram but the focus never comes to the Hyperlinks (that I created via the extension). I understand that the hyperlinks are essentially textblocks at their core but I was wondering if there is some way to make it possible to reach them via keyboard navigation so that the user can reach them and then possibly “click” them using just the keyboard.
Yes, I believe you could implement some kind of appearance and behavior changes to represent “focus”.
If you are not already using Part.isHighlighted, https://gojs.net/latest/intro/highlighting.html, then you can use that. Make sure your code allows at most one node to be highlighted at one time.
Then handle the Tab, space, and Enter keys to do what you want. https://gojs.net/latest/intro/commands.html The DrawCommandHandler extension, https://gojs.net/latest/extensions/DrawCommandHandler.js, demonstrates handling the arrow keys to get various kinds of behaviors.
I was hoping to find something similar to the “tabindex” property in HTML that allows an element to be focusable. I would ideally not want to manage the keyboard accessibility programmatically.
Sorry, but you do have the flexibility to implement what you want. By default there are no commands bound to the Tab and Enter keys, and the space key is bound to an unrelated command.