Skip to content

Commit 066ccff

Browse files
eps1lonljharb
authored andcommitted
[Docs] no-noninteractive-tabindex: Add example for tabIndex on seemingly non-interactive element
Closes #717
1 parent 6b19aa5 commit 066ccff

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/rules/no-noninteractive-tabindex.md

+9
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ It is not necessary to put a tabindex on an `<article>`, for instance or on `<li
4646

4747
Your application might require an exception to this rule in the case of an element that captures incoming tab traversal for a composite widget. In that case, turn off this rule on a per instance basis. This is an uncommon case.
4848

49+
If you know that a particular element will be scrollable, you might want to add `tabindex="0"` if your website supports browsers that don't make these containers keyboard-focusable. The current status for this platform feature can be tracked in [Chrome Platform Status "Feature: Keyboard-focusable scroll containers"](https://www.chromestatus.com/feature/5231964663578624).
50+
51+
```jsx
52+
// eslint-disable-next-line no-noninteractive-tabindex
53+
<pre tabIndex="0">
54+
<code>{someLongCode}</code>
55+
</pre>
56+
```
57+
4958
## Rule details
5059

5160
The recommended options for this rule allow `tabIndex` on elements with the noninteractive `tabpanel` role. Adding `tabIndex` to a tabpanel is a recommended practice in some instances.

0 commit comments

Comments
 (0)