Visio defaults to tabbing from shape to shape in the order that the shapes are added to the page. However, this can end up with an illogical order if you are trying to navigate a diagram with the keyboard, which is often an accessibility requirement. Fortunately, Visio provides a Diagram Navigation pane so that the tab order can be changed, but how does it do it? The following short video shows how the navigation order, displayed as numbers in each shape, is assigned a value as soon as the order is edited.
Accessibility is important in my current project, so understanding how this happens was important to understand, and to surface this order to JavaScript, as we want to list the shapes in a logical order too.
I managed this by adding a User.visNavOrder to the master shape of all the significant masters, and a hidden Shape Data row, labelled “Navigation Order“. This has the following formula for its value:
=GUARD(User.visNavOrder)
If User.visNavOrder is not already present in a shape, then Visio will automatically add it when the View / Show / Task Panes / Diagram Navigation panel is used. However, I need it to already exist so that a Shape Data row can reference it, because Shape Data rows are exposed to the Visio Online JavaScript API and User-defined Cells are not. Then the order of the shapes collection can be made to match the tab order in the diagram.
In the above video clip, the Navigation Order Shape Data row is displayed as text on each shape so that it is clear how Visio is automatically assigning values to User.visNavOrder when the Diagram Navigation panel is used.
In addition to each shape getting the User.visNavOrder cell, the page itself gets a User.visNavType cell with a value of 1. Setting this value to 0 will suspend the update of the User.visNavOrder cells in the shapes until the Diagram Navigation panel is used to manipulate the order again, which will set the value back to 1 again.
Ensuring Accessibility in Visio
Make your Visio diagram accessible to people with disabilities
Ensuring High Contrast Text in Visio Shapes
Ann PV says
Hi there!
Is this feature available in Viso 2013 Professional Version?
David Parker says
I don’t think so, I think it came in with 2016.
Rohit Patil says
Hey, can I programmatically set user.visNavOrder to 1
Rohit Patil says
Sorry I meant “User.visNavType” for page
David Parker says
Yes you can. eg page.Cells(“User.visNavType”).FormulaU = 1
If the visNavType is 1 then the navigation order will respect the visNavOrder values
If the visNavType is 0 then the navigation order will be as the shapes were dropped on the page