Some test text!

Search
Hamburger Icon

Web / FAQ / Why does tabbing between form fields go in the wrong order?

Form Widget Tab Ordering

In PDF documents the tabbing order for forms is defined by the order of form widget annotations in the annotation list. Some PDFs will have a tree structure that defines how certain elements and widgets in the document are ordered and if this structure exists then that will define the form tab order instead.

It can be quite expensive to parse through the entire structure (especially with a long and complex document) so by default WebViewer's tab order is based on the annotation list order.

Starting in WebViewer 10.3 you are able to have WebViewer use the order of the "logical structure" tree to define the widget tab order.

Enabling widget tab ordering

This requires the full API.

To enable structure parsing and ensuring the widget order is respected, you can enable this via AnnotationManager.enableWidgetTabOrdering.

WebViewer({
  path: 'path/to/lib',
  fullAPI: true,
  ...
})
  .then((instance) => {
    const { annotationManager } = instance.Core;
    // Starts parsing the structure and ordering the widgets
    annotationManager.enableWidgetTabOrdering();
  });

To disable it, you can use AnnotationManager.disableWidgetTabOrdering instead.

Types of widget ordering

There are various types of widget orderings that can be set on widgets on a form as defined by the PDF specification. By default, the ordering of the widgets uses Structure ordering. However, you can use Row or Column ordering as well. These are supported by WebViewer.

You can find the TabbingOrders constant with these values on the AnnotationManager class itself.

instance.Core.AnnotationManager.TabbingOrders.STRUCTURE;

Getting the widget tab order

You can get the tab order being used using AnnotationManager.getTabOrder. This will provide a value that matches one of the ones found in the TabbingOrders constant mentioned above.

if (annotationManager.getTabOrder() === instance.Core.AnnotationManager.TabbingOrders.STRUCTURE) {
  // Do something...
}

Changing the widget tab order

You can also change the tab order of widget with AnnotationManager.setTabOrder. This function expects a value found in the TabbingOrders constant mentioned above. This will update the loaded document with the newly set widget ordering.

// Order widgets from left to right, top to bottom
annotationManager.setTabOrder(instance.Core.AnnotationManager.TabbingOrders.ROW);

Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales