According to specification:
Positive values assigned by tabindex arrange items according to tabindex values
negative values make the elements "non-orientable"
a value of 0 makes the element focusable but dependent on order on the platform
mdn-html tabindex specification
So, if you want a specific order to be defined on your page, you need to assign a value to each element.
But here comes jquery: Let's say that the elements that should be in order are in the div with id="myDiv" Then you can:
$("#myDiv").find("*").prop("tabindex", 1);
This means that every child / subchild element from myDiv has tabindex of 1. Then your two buttons can have the css class assigned (for example: class="highTabIndex" ).
Then you can call jquery again:
var idx = 2; $("#myDiv").find(".highTabIndex").each(function(idx, element) { element.prop("tabindex", idx++); });
and your buttons with the highTabIndex class will be arranged according to the "position" on the page.
source share