aria-ease 1.5.5 → 1.5.6
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/Types.d.ts +0 -2
- package/package.json +1 -1
- package/src/toggle/group/updateGroupTogglesAriaAttributes.js +0 -1
- package/src/toggle/group/updateGroupTogglesAriaAttributes.ts +0 -1
- package/src/toggle/single/updateSingleToggleAriaAttribute.js +5 -7
- package/src/toggle/single/updateSingleToggleAriaAttribute.ts +5 -7
package/Types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -12,7 +12,6 @@ export function updateGroupTogglesAriaAttributes(toggleStates, togglesClass, cur
|
|
|
12
12
|
allToggles.forEach(function (toggle, index) {
|
|
13
13
|
if (index === currentPressedToggleIndex) {
|
|
14
14
|
toggle.setAttribute("aria-pressed", toggleStates[index].pressed ? 'true' : 'false');
|
|
15
|
-
toggle.setAttribute("aria-label", toggleStates[index].pressed ? toggleStates[index].pressedAriaLabel : toggleStates[index].unpressedAriaLabel);
|
|
16
15
|
}
|
|
17
16
|
});
|
|
18
17
|
}
|
|
@@ -17,7 +17,6 @@ export function updateGroupTogglesAriaAttributes(toggleStates: ToggleStates[], t
|
|
|
17
17
|
allToggles.forEach((toggle, index) => {
|
|
18
18
|
if (index === currentPressedToggleIndex) {
|
|
19
19
|
toggle.setAttribute("aria-pressed", toggleStates[index].pressed ? 'true' : 'false');
|
|
20
|
-
toggle.setAttribute("aria-label", toggleStates[index].pressed ? toggleStates[index].pressedAriaLabel : toggleStates[index].unpressedAriaLabel);
|
|
21
20
|
}
|
|
22
21
|
});
|
|
23
22
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param {string} toggleClass The class of all the toggle element
|
|
4
4
|
* @param {string} updatedAriaLabel The aria label to be updated to toggle element
|
|
5
5
|
*/
|
|
6
|
-
export function updateSingleToggleAriaAttribute(toggleClass
|
|
6
|
+
export function updateSingleToggleAriaAttribute(toggleClass) {
|
|
7
7
|
var toggle = document.querySelector(".".concat(toggleClass));
|
|
8
8
|
if (!toggle) {
|
|
9
9
|
throw new Error('Invalid toggle class provided.');
|
|
@@ -12,15 +12,13 @@ export function updateSingleToggleAriaAttribute(toggleClass, updatedAriaLabel) {
|
|
|
12
12
|
if (!currentAriaPressedState) {
|
|
13
13
|
throw new Error("Toggle element does not have aria-pressed attribute");
|
|
14
14
|
}
|
|
15
|
-
function togglePressed(
|
|
15
|
+
function togglePressed() {
|
|
16
16
|
toggle.setAttribute('aria-pressed', 'true');
|
|
17
|
-
toggle.setAttribute('aria-label', ariaLabel);
|
|
18
17
|
}
|
|
19
|
-
function toggleUnpressed(
|
|
18
|
+
function toggleUnpressed() {
|
|
20
19
|
toggle.setAttribute('aria-pressed', 'false');
|
|
21
|
-
toggle.setAttribute('aria-label', ariaLabel);
|
|
22
20
|
}
|
|
23
21
|
(currentAriaPressedState === 'false') ?
|
|
24
|
-
togglePressed(
|
|
25
|
-
toggleUnpressed(
|
|
22
|
+
togglePressed() :
|
|
23
|
+
toggleUnpressed();
|
|
26
24
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { HTMLElement } from "../../../Types";
|
|
8
8
|
|
|
9
|
-
export function updateSingleToggleAriaAttribute(toggleClass: string
|
|
9
|
+
export function updateSingleToggleAriaAttribute(toggleClass: string): void {
|
|
10
10
|
const toggle: HTMLElement = document.querySelector(`.${toggleClass}`) as HTMLElement;
|
|
11
11
|
|
|
12
12
|
if( !toggle) {
|
|
@@ -18,17 +18,15 @@ export function updateSingleToggleAriaAttribute(toggleClass: string, updatedAria
|
|
|
18
18
|
throw new Error("Toggle element does not have aria-pressed attribute")
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
function togglePressed(
|
|
21
|
+
function togglePressed(): void {
|
|
22
22
|
toggle.setAttribute('aria-pressed', 'true');
|
|
23
|
-
toggle.setAttribute('aria-label', ariaLabel);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
function toggleUnpressed(
|
|
25
|
+
function toggleUnpressed(): void {
|
|
27
26
|
toggle.setAttribute('aria-pressed', 'false');
|
|
28
|
-
toggle.setAttribute('aria-label', ariaLabel);
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
(currentAriaPressedState === 'false') ?
|
|
32
|
-
togglePressed(
|
|
33
|
-
toggleUnpressed(
|
|
30
|
+
togglePressed() :
|
|
31
|
+
toggleUnpressed()
|
|
34
32
|
}
|