2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Use tabindex to Add Keyboard Focus to an Element
|
|
|
|
---
|
2019-07-24 00:59:27 -07:00
|
|
|
# Use tabindex to Add Keyboard Focus to an Element
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
## Solutions
|
|
|
|
<details><summary>Solution 1 (Click to Show/Hide)</summary>
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
Following the instructions:
|
|
|
|
|
|
|
|
Add a tabindex attribute to the p tag and set its value to "0".
|
|
|
|
|
|
|
|
|
|
|
|
the line 16
|
2019-07-24 00:59:27 -07:00
|
|
|
```css
|
2018-10-12 15:37:13 -04:00
|
|
|
<p>Instructions: Fill in ALL your information then click <b>Submit</b></p>
|
|
|
|
```
|
|
|
|
|
|
|
|
becomes:
|
2019-07-24 00:59:27 -07:00
|
|
|
```css
|
2018-10-12 15:37:13 -04:00
|
|
|
<p tabindex="0">Instructions: Fill in ALL your information then click <b>Submit</b></p>
|
|
|
|
```
|
|
|
|
|
|
|
|
In this way it will receive keyboard focus when a user tabs through a page.
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
</details>
|