aria-ease 2.3.0 → 2.4.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/dist/index.d.cts CHANGED
@@ -35,7 +35,9 @@ declare function updateAccordionTriggerAriaAttributes(accordionId: string, accor
35
35
  * @param {string} blockId The id of the block container.
36
36
  * @param {string} blockItemsClass The shared class of the elements that are children of the block.
37
37
  */
38
- declare function makeBlockAccessible(blockId: string, blockItemsClass: string): () => void;
38
+ declare function makeBlockAccessible(blockId: string, blockItemsClass: string): {
39
+ cleanup: () => void;
40
+ };
39
41
 
40
42
  /**
41
43
  * Adds screen reader accessibility to multiple checkboxes. Updates the aria attributes of the checkboxes. Checkbox elements must possess the following aria attributes; aria-checked and aria-label.
package/dist/index.d.ts CHANGED
@@ -35,7 +35,9 @@ declare function updateAccordionTriggerAriaAttributes(accordionId: string, accor
35
35
  * @param {string} blockId The id of the block container.
36
36
  * @param {string} blockItemsClass The shared class of the elements that are children of the block.
37
37
  */
38
- declare function makeBlockAccessible(blockId: string, blockItemsClass: string): () => void;
38
+ declare function makeBlockAccessible(blockId: string, blockItemsClass: string): {
39
+ cleanup: () => void;
40
+ };
39
41
 
40
42
  /**
41
43
  * Adds screen reader accessibility to multiple checkboxes. Updates the aria attributes of the checkboxes. Checkbox elements must possess the following aria attributes; aria-checked and aria-label.
package/dist/index.js CHANGED
@@ -9330,14 +9330,14 @@ function makeBlockAccessible(blockId, blockItemsClass) {
9330
9330
  const blockDiv = document.querySelector(`#${blockId}`);
9331
9331
  if (!blockDiv) {
9332
9332
  console.error(`[aria-ease] Element with id="${blockId}" not found. Make sure the block element exists before calling makeBlockAccessible.`);
9333
- return function cleanUpBlockEventListeners() {
9334
- };
9333
+ return { cleanup: () => {
9334
+ } };
9335
9335
  }
9336
9336
  const blockItems = blockDiv.querySelectorAll(`.${blockItemsClass}`);
9337
9337
  if (!blockItems || blockItems.length === 0) {
9338
9338
  console.error(`[aria-ease] Element with class="${blockItemsClass}" not found. Make sure the block items exist before calling makeBlockAccessible.`);
9339
- return function cleanUpBlockEventListeners() {
9340
- };
9339
+ return { cleanup: () => {
9340
+ } };
9341
9341
  }
9342
9342
  blockItems.forEach((blockItem) => {
9343
9343
  if (!eventListenersMap.has(blockItem)) {
@@ -9350,7 +9350,7 @@ function makeBlockAccessible(blockId, blockItemsClass) {
9350
9350
  eventListenersMap.set(blockItem, handler);
9351
9351
  }
9352
9352
  });
9353
- return function cleanUpBlockEventListeners() {
9353
+ function cleanup() {
9354
9354
  blockItems.forEach((blockItem) => {
9355
9355
  const handler = eventListenersMap.get(blockItem);
9356
9356
  if (handler) {
@@ -9358,7 +9358,9 @@ function makeBlockAccessible(blockId, blockItemsClass) {
9358
9358
  eventListenersMap.delete(blockItem);
9359
9359
  }
9360
9360
  });
9361
- };
9361
+ }
9362
+ ;
9363
+ return { cleanup };
9362
9364
  }
9363
9365
 
9364
9366
  // src/checkbox/src/updateCheckboxAriaAttributes/updateCheckboxAriaAttributes.ts