tabIndex property of a Tab item is used to enable tab key navigation for that particular item. When a positive value is assigned to the
tabIndex property, it allows the user to switch focus to the next or previous tab item using the Tab or Shift+Tab keys. By default, the user can only switch between tab items using the arrow keys.
tabIndex value is set to 0 for all tab items, the tab will switch based on the order of the elements on the page. This means that if the tab items are listed in a specific order on the page, the user will be able to navigate through them using the Tab key in that same order.
To use the
tabIndex property, you can assign a positive value to the property of each tab item that you want to enable tab key navigation. For example:
<!DOCTYPE html> <html lang="en"> <head> <title>Essential JS 2 Tab</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="description" content="Typescript Toolbar Controls" /> <meta name="author" content="Syncfusion" /> <link href="index.css" rel="stylesheet" /> <link href="//cdn.syncfusion.com/ej2/21.2.3/material.css" rel="stylesheet" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script> <script src="systemjs.config.js"></script> </head> <body> <div id='loader'>LOADING....</div> <div id='container'> <div class="e-tab-height" style="height:300px"> <div class="EventLog" id="EventLog" style="word-break: normal;padding: 5px;"></div> <div id="selectTab"></div> <div id='element'></div> </div> <div id='result'></div> </div> </body> </html>
With this code, the user will be able to switch between the tab items using the Tab and Shift+Tab keys, in the order specified by the
It’s important to note that the
tabIndex property only affects the ability to navigate between tab items using the Tab key. The user will still be able to use the arrow keys to switch between tab items, regardless of the value of the