Reputation: 549
Suppose you want to make a custom HTML tag and use it one or more times on the same HTML page. What should the tabindex be for each tag so tabbing works correctly?
Upvotes: 0
Views: 2669
Reputation: 2580
It should just be tabindex="0" for every html tag, it'll allow you to essentially tab and backtab to the element if you were not able to before. Pretty much for accessibility and UX for navigation.
What is the HTML tabindex attribute?
Upvotes: 0
Reputation: 549
We used tabindex="0" for a custom checkbox created as an Angular component. Now our new HTML tag (eg. ) may be used one or more times on the same HTML and tabbing works correctly.
We set tabindex="0" on the surround div in the component's HTML:
<div ng-click="$ctrl.toggle()" tabindex="0">
<input id="{{::$ctrl.inputId}}" type="checkbox" name="{{::$ctrl.name}}" ng-model="$ctrl.checked" />
</div>
Upvotes: 3