aria-ease 1.1.8 → 1.2.0
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/aria-ease.d.ts
CHANGED
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
declare module 'aria-ease' {
|
|
5
5
|
/**
|
|
6
|
-
* Adds keyboard
|
|
6
|
+
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first item of the menu has focus when menu appears.
|
|
7
7
|
* @param {string} menuId - The id of the menu.
|
|
8
8
|
* @param {string} menuItemClass - The class of the items that are children of the menu.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
function makeMenuAccessible(menuId: string, menuItemClass: string): void;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Adds keyboard
|
|
13
|
+
* Adds keyboard interaction to tab. The tab traps focus and can be interacted with using the keyboard.
|
|
14
14
|
* @param {string} tabId - The id of the tab container.
|
|
15
15
|
* @param {string} tabItemClass - The class of the individual tab items.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
function makeTabAccessible(tabId: string, tabItemClass: string): void;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Updates the aria attributes of the menu trigger button. Trigger button element must possess the following aria attributes; aria-expanded, aria-pressed, aria-label.
|
|
21
21
|
* @param {string} triggerId The id of the trigger button that toggles the menu.
|
|
22
22
|
* @param {string} ariaLabel The aria-label to be updated.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
function updateMenuTriggerAriaAttributes(triggerId: string, ariaLabel: string): void;
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Adds keyboard
|
|
2
|
+
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first item of the menu has focus when menu appears.
|
|
3
3
|
* @param {string} menuId The id of the menu
|
|
4
4
|
* @param {string} menuItemClass The class of the items that are children of the menu
|
|
5
5
|
*/
|
|
@@ -17,7 +17,6 @@ export function makeMenuAccessible(menuId, menuItemClass) {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
function handleKeyPress(event, menuItems, menuItemIndex) {
|
|
20
|
-
event.preventDefault();
|
|
21
20
|
switch (event.key) {
|
|
22
21
|
case 'ArrowUp':
|
|
23
22
|
case 'ArrowLeft':
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Adds keyboard
|
|
2
|
+
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first item of the menu has focus when menu appears.
|
|
3
3
|
* @param {string} menuId The id of the menu
|
|
4
4
|
* @param {string} menuItemClass The class of the items that are children of the menu
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { HTMLElement, NodeListOfHTMLElement } from '../../Types'
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
let eventListenersAdded: Set<HTMLElement> = new Set();
|
|
11
10
|
|
|
12
|
-
|
|
13
11
|
export function makeMenuAccessible(menuId: string, menuItemClass: string): void {
|
|
14
12
|
const menuDiv: HTMLElement = document.querySelector(`#${menuId}`) as HTMLElement
|
|
15
13
|
const menuItems: NodeListOfHTMLElement = menuDiv.querySelectorAll(`.${menuItemClass}`)
|
|
@@ -26,7 +24,6 @@ export function makeMenuAccessible(menuId: string, menuItemClass: string): void
|
|
|
26
24
|
})
|
|
27
25
|
|
|
28
26
|
function handleKeyPress(event: KeyboardEvent, menuItems: NodeListOfHTMLElement, menuItemIndex: number): void {
|
|
29
|
-
event.preventDefault()
|
|
30
27
|
switch(event.key) {
|
|
31
28
|
case 'ArrowUp':
|
|
32
29
|
case 'ArrowLeft':
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Adds keyboard
|
|
2
|
+
* Adds keyboard interaction to tab. The tab traps focus and can be interacted with using the keyboard.
|
|
3
3
|
* @param {string} tabId The id of the tab
|
|
4
4
|
* @param {string} tabItemClass The class of the items that are children of the tab
|
|
5
5
|
*/
|
|
@@ -14,7 +14,6 @@ export function makeTabAccessible(tabId, tabItemClass) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
function handleKeyPress(event, tabItems, tabItemIndex) {
|
|
17
|
-
event.preventDefault();
|
|
18
17
|
switch (event.key) {
|
|
19
18
|
case 'ArrowUp':
|
|
20
19
|
case 'ArrowLeft':
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Adds keyboard
|
|
2
|
+
* Adds keyboard interaction to tab. The tab traps focus and can be interacted with using the keyboard.
|
|
3
3
|
* @param {string} tabId The id of the tab
|
|
4
4
|
* @param {string} tabItemClass The class of the items that are children of the tab
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { HTMLElement, NodeListOfHTMLElement } from "../../Types"
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
let eventListenersAdded: Set<HTMLElement> = new Set();
|
|
11
10
|
|
|
12
|
-
|
|
13
11
|
export function makeTabAccessible(tabId: string, tabItemClass: string): void {
|
|
14
12
|
const tabDiv: HTMLElement = document.querySelector(`#${tabId}`) as HTMLElement
|
|
15
13
|
const tabItems: NodeListOfHTMLElement = tabDiv.querySelectorAll(`.${tabItemClass}`)
|
|
@@ -22,7 +20,6 @@ export function makeTabAccessible(tabId: string, tabItemClass: string): void {
|
|
|
22
20
|
});
|
|
23
21
|
|
|
24
22
|
function handleKeyPress(event: KeyboardEvent, tabItems: NodeListOfHTMLElement, tabItemIndex: number): void {
|
|
25
|
-
event.preventDefault()
|
|
26
23
|
switch(event.key) {
|
|
27
24
|
case 'ArrowUp':
|
|
28
25
|
case 'ArrowLeft':
|