aria-ease 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,24 +59,25 @@ export default App
|
|
|
59
59
|
|
|
60
60
|
Add accessibility to tab: tab can be tabs, interactive sliders and carousels e.t.c. Basically any component that is permanently displayed and has a list of related interractive children items. The function creates a focus trap within the tab and the focus can be navigated using the arrow keys.
|
|
61
61
|
|
|
62
|
-
The makeTabAccessible function takes two string arguments; the id of the tab main div, and the class name of the children item of the div. The function should be called
|
|
62
|
+
The makeTabAccessible function takes two string arguments; the id of the tab main div, and the class name of the children item of the div. The function should be called on page render, so the event listeners get activated. On click of a button, the clicked button gets focused and the focus can be navigated using the arrow keys.
|
|
63
63
|
|
|
64
64
|
#### Usage
|
|
65
65
|
|
|
66
66
|
```
|
|
67
|
+
import { useEffect } from 'react'
|
|
67
68
|
import { makeTabAccessible } from "aria-ease"
|
|
68
69
|
|
|
69
70
|
const App = () => {
|
|
70
|
-
|
|
71
|
+
useEffect(() => {
|
|
71
72
|
makeTabAccessible('custom-tab', 'custom-tab-item')
|
|
72
|
-
}
|
|
73
|
+
},[])
|
|
73
74
|
|
|
74
75
|
return (
|
|
75
76
|
<div>
|
|
76
77
|
<div id="custom-tab">
|
|
77
|
-
<button className="custom-tab-item"
|
|
78
|
-
<button className="custom-tab-item"
|
|
79
|
-
<button className="custom-tab-item"
|
|
78
|
+
<button className="custom-tab-item">One</button>
|
|
79
|
+
<button className="custom-tab-item">Two</button>
|
|
80
|
+
<button className="custom-tab-item">Three</button>
|
|
80
81
|
</div>
|
|
81
82
|
</div>
|
|
82
83
|
)
|