How does tabindex/focusindex work?

I am building a custom widget in which i have to interfere with the default tab behaviour. To do this properly i would need to know a bit more on what the current behaviour is. Setting the tab index attribute in Mendix seems to result in a focusindex attribute on the dom. While i cannot find anything on focusindex it seems to behave just like what you would expect from a tabindex attribute, so how does this work exactly?
2 answers

Tab index (only in web forms)

The tab index influences the order in which the end user navigates through the form using the tab key. By default tab indices are zero and the tab order is determined automatically by the client system. A value of minus one (-1) means that the widget will be skipped when tabbing through the form.

Default value: 0


In case anyone found this question via a Google search (as I did), I’ve found an explanation of ‘focusindex’ here:


“As our pages and widgets are dynamic by their nature we need something more flexible then just a flat tab order defined bytabindex. We use so-called "nested" tab order. Additional custom property focusindex​simply "marks" a DOM node as a container where tabindex (or natural tab order) of underlying focus-able elements is "local".
We named it focusindex​to prevent the clash with tabindex on naturally non focus-able elements. That makes them focus-able and we don't want that in this case.”