aria-ease 1.3.0 → 1.3.1
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 +8 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,9 +19,9 @@ The updateMenuTriggerAriaAttributes function take two string arguments; the id o
|
|
|
19
19
|
```
|
|
20
20
|
import { makeMenuAccessible, updateMenuTriggerAriaAttributes, cleanUpMenuEventListeners } from 'aria-ease'
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const MenuExample = () => {
|
|
23
23
|
const toggleMenuDisplay = (event) => {
|
|
24
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
24
|
+
if (event.type === 'mousedown' || (event.type === 'keydown' && (event.key === 'Enter' || event.key === ' '))) {
|
|
25
25
|
event.preventDefault();
|
|
26
26
|
const menu = document.querySelector('#custom-menu');
|
|
27
27
|
if (getComputedStyle(menu).display === 'none') {
|
|
@@ -35,17 +35,18 @@ const HomeExampleMenu = () => {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
|
|
38
39
|
return (
|
|
39
40
|
<div>
|
|
40
41
|
<button
|
|
41
42
|
id="display-button"
|
|
42
|
-
|
|
43
|
+
onMouseDown={toggleMenuDisplay}
|
|
43
44
|
aria-haspopup={true}
|
|
44
45
|
aria-pressed={false}
|
|
45
46
|
aria-expanded={false}
|
|
46
47
|
aria-controls="custom-menu"
|
|
47
48
|
aria-label="Display profile menu"
|
|
48
|
-
className='
|
|
49
|
+
className='menu-example-trigger-button block-interactive'
|
|
49
50
|
onKeyDown={toggleMenuDisplay}
|
|
50
51
|
>
|
|
51
52
|
Display Example Menu
|
|
@@ -59,7 +60,7 @@ const HomeExampleMenu = () => {
|
|
|
59
60
|
)
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
export default
|
|
63
|
+
export default MenuExample
|
|
63
64
|
```
|
|
64
65
|
|
|
65
66
|
Add accessibility to block: block can be entire web page body, 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 block and the focus can be navigated using the arrow keys.
|
|
@@ -72,7 +73,7 @@ The makeBlockAccessible function takes two string arguments; the id of the block
|
|
|
72
73
|
import { useEffect } from 'react'
|
|
73
74
|
import { makeBlockAccessible } from "aria-ease"
|
|
74
75
|
|
|
75
|
-
const
|
|
76
|
+
const BlockExample = () => {
|
|
76
77
|
useEffect(() => {
|
|
77
78
|
const cleanUp = makeBlockAccessible('custom-tab', 'custom-tab-item')
|
|
78
79
|
|
|
@@ -90,7 +91,7 @@ const App = () => {
|
|
|
90
91
|
)
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
export default
|
|
94
|
+
export default BlockExample
|
|
94
95
|
```
|
|
95
96
|
|
|
96
97
|
### P.S.
|