aria-ease 1.1.2 → 1.1.3
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/package.json +1 -1
- package/src/menu/makeMenuAccessible.js +9 -0
- package/src/menu/makeMenuAccessible.ts +8 -0
- package/src/tab/makeTabAccessible.js +11 -0
- package/src/tab/makeTabAccessible.ts +10 -0
- package/tsconfig.json +1 -1
- package/src/menu/makeMenuAccessible.d.ts +0 -6
- package/src/menu/updateMenuTriggerAriaAttributes.d.ts +0 -6
- package/src/tab/makeTabAccessible.d.ts +0 -6
package/package.json
CHANGED
|
@@ -39,6 +39,15 @@ export function makeMenuAccessible(menuId, menuItemClass) {
|
|
|
39
39
|
null;
|
|
40
40
|
triggerButton.focus();
|
|
41
41
|
break;
|
|
42
|
+
case 'Enter':
|
|
43
|
+
case ' ':
|
|
44
|
+
if (menuItems.item(menuItemIndex).tagName === 'BUTTON') {
|
|
45
|
+
menuItems.item(menuItemIndex).click();
|
|
46
|
+
}
|
|
47
|
+
else if (menuItems.item(menuItemIndex).tagName === 'A') {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
window.location.href = menuItems.item(menuItemIndex).href;
|
|
50
|
+
}
|
|
42
51
|
default:
|
|
43
52
|
break;
|
|
44
53
|
}
|
|
@@ -43,6 +43,14 @@ export function makeMenuAccessible(menuId: string, menuItemClass: string): void
|
|
|
43
43
|
null
|
|
44
44
|
triggerButton.focus()
|
|
45
45
|
break;
|
|
46
|
+
case 'Enter':
|
|
47
|
+
case ' ':
|
|
48
|
+
if(menuItems.item(menuItemIndex).tagName === 'BUTTON') {
|
|
49
|
+
menuItems.item(menuItemIndex).click()
|
|
50
|
+
} else if (menuItems.item(menuItemIndex).tagName === 'A') {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
window.location.href = menuItems.item(menuItemIndex).href;
|
|
53
|
+
}
|
|
46
54
|
default:
|
|
47
55
|
break;
|
|
48
56
|
}
|
|
@@ -30,6 +30,17 @@ export function makeTabAccessible(tabId, tabItemClass) {
|
|
|
30
30
|
tabItems.item(tabItemIndex + 1).focus();
|
|
31
31
|
}
|
|
32
32
|
break;
|
|
33
|
+
case 'Enter':
|
|
34
|
+
case ' ':
|
|
35
|
+
if (tabItems.item(tabItemIndex).type === 'radio') {
|
|
36
|
+
tabItems.item(tabItemIndex).checked = true;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
else if (tabItems.item(tabItemIndex).type === 'checkbox') {
|
|
40
|
+
tabItems.item(tabItemIndex).checked = !tabItems.item(tabItemIndex).checked;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
33
44
|
default:
|
|
34
45
|
break;
|
|
35
46
|
}
|
|
@@ -33,6 +33,16 @@ export function makeTabAccessible(tabId: string, tabItemClass: string): void {
|
|
|
33
33
|
tabItems.item(tabItemIndex + 1).focus();
|
|
34
34
|
}
|
|
35
35
|
break;
|
|
36
|
+
case 'Enter':
|
|
37
|
+
case ' ':
|
|
38
|
+
if (tabItems.item(tabItemIndex).type === 'radio') {
|
|
39
|
+
tabItems.item(tabItemIndex).checked = true
|
|
40
|
+
break;
|
|
41
|
+
} else if (tabItems.item(tabItemIndex).type === 'checkbox') {
|
|
42
|
+
tabItems.item(tabItemIndex).checked = !tabItems.item(tabItemIndex).checked
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
36
46
|
default:
|
|
37
47
|
break;
|
|
38
48
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adds keyboard navigation 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
|
-
* @param {string} menuId The id of the menu
|
|
4
|
-
* @param {string} menuItemClass The class of the items that are children of the menu
|
|
5
|
-
*/
|
|
6
|
-
export declare function makeMenuAccessible(menuId: string, menuItemClass: string): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Updates the aria attributes of the menu trigger button. Trigger button element must possess the following aria attributes; aria-expanded, aria-pressed, aria-label.
|
|
3
|
-
* @param {string} triggerId The id of the trigger button that toggles the menu.
|
|
4
|
-
* @param {string} ariaLabel The aria-label to be updated.
|
|
5
|
-
*/
|
|
6
|
-
export declare function updateMenuTriggerAriaAttributes(triggerId: string, ariaLabel: string): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adds keyboard navigation to tab. The tab traps focus and can be interacted with using the keyboard.
|
|
3
|
-
* @param {string} tabId The id of the tab
|
|
4
|
-
* @param {string} tabItemClass The class of the items that are children of the tab
|
|
5
|
-
*/
|
|
6
|
-
export declare function makeTabAccessible(tabId: string, tabItemClass: string): void;
|