aria-ease 2.9.0 → 3.0.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/dist/index.cjs CHANGED
@@ -10033,6 +10033,10 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
10033
10033
  }, cleanup: () => {
10034
10034
  } };
10035
10035
  }
10036
+ triggerButton.setAttribute("aria-haspopup", "true");
10037
+ triggerButton.setAttribute("aria-controls", menuId);
10038
+ triggerButton.setAttribute("aria-expanded", "false");
10039
+ menuDiv.setAttribute("role", "menu");
10036
10040
  const handlerMap = /* @__PURE__ */ new WeakMap();
10037
10041
  const submenuInstances = /* @__PURE__ */ new Map();
10038
10042
  let cachedItems = null;
@@ -10162,6 +10166,13 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
10162
10166
  setAria(false);
10163
10167
  triggerButton.focus();
10164
10168
  }
10169
+ function intializeMenuItems() {
10170
+ const items = getItems();
10171
+ items.forEach((item) => {
10172
+ item.setAttribute("role", "menuitem");
10173
+ });
10174
+ }
10175
+ intializeMenuItems();
10165
10176
  function cleanup() {
10166
10177
  removeListeners();
10167
10178
  menuDiv.style.display = "none";
package/dist/index.js CHANGED
@@ -9435,6 +9435,10 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
9435
9435
  }, cleanup: () => {
9436
9436
  } };
9437
9437
  }
9438
+ triggerButton.setAttribute("aria-haspopup", "true");
9439
+ triggerButton.setAttribute("aria-controls", menuId);
9440
+ triggerButton.setAttribute("aria-expanded", "false");
9441
+ menuDiv.setAttribute("role", "menu");
9438
9442
  const handlerMap = /* @__PURE__ */ new WeakMap();
9439
9443
  const submenuInstances = /* @__PURE__ */ new Map();
9440
9444
  let cachedItems = null;
@@ -9564,6 +9568,13 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
9564
9568
  setAria(false);
9565
9569
  triggerButton.focus();
9566
9570
  }
9571
+ function intializeMenuItems() {
9572
+ const items = getItems();
9573
+ items.forEach((item) => {
9574
+ item.setAttribute("role", "menuitem");
9575
+ });
9576
+ }
9577
+ intializeMenuItems();
9567
9578
  function cleanup() {
9568
9579
  removeListeners();
9569
9580
  menuDiv.style.display = "none";
@@ -145,6 +145,10 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
145
145
  }, cleanup: () => {
146
146
  } };
147
147
  }
148
+ triggerButton.setAttribute("aria-haspopup", "true");
149
+ triggerButton.setAttribute("aria-controls", menuId);
150
+ triggerButton.setAttribute("aria-expanded", "false");
151
+ menuDiv.setAttribute("role", "menu");
148
152
  const handlerMap = /* @__PURE__ */ new WeakMap();
149
153
  const submenuInstances = /* @__PURE__ */ new Map();
150
154
  let cachedItems = null;
@@ -274,6 +278,13 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
274
278
  setAria(false);
275
279
  triggerButton.focus();
276
280
  }
281
+ function intializeMenuItems() {
282
+ const items = getItems();
283
+ items.forEach((item) => {
284
+ item.setAttribute("role", "menuitem");
285
+ });
286
+ }
287
+ intializeMenuItems();
277
288
  function cleanup() {
278
289
  removeListeners();
279
290
  menuDiv.style.display = "none";
@@ -25,6 +25,10 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
25
25
  }, cleanup: () => {
26
26
  } };
27
27
  }
28
+ triggerButton.setAttribute("aria-haspopup", "true");
29
+ triggerButton.setAttribute("aria-controls", menuId);
30
+ triggerButton.setAttribute("aria-expanded", "false");
31
+ menuDiv.setAttribute("role", "menu");
28
32
  const handlerMap = /* @__PURE__ */ new WeakMap();
29
33
  const submenuInstances = /* @__PURE__ */ new Map();
30
34
  let cachedItems = null;
@@ -154,6 +158,13 @@ function makeMenuAccessible({ menuId, menuItemsClass, triggerId }) {
154
158
  setAria(false);
155
159
  triggerButton.focus();
156
160
  }
161
+ function intializeMenuItems() {
162
+ const items = getItems();
163
+ items.forEach((item) => {
164
+ item.setAttribute("role", "menuitem");
165
+ });
166
+ }
167
+ intializeMenuItems();
157
168
  function cleanup() {
158
169
  removeListeners();
159
170
  menuDiv.style.display = "none";
@@ -81,7 +81,7 @@
81
81
  "assertion": "toHaveAttribute",
82
82
  "attribute": "aria-selected",
83
83
  "expectedValue": "true | false",
84
- "failureMessage": "Each option should have 'aria-selected' attribute to indicate selection state."
84
+ "failureMessage": "Each listbox option should have 'aria-selected' attribute to indicate selection state."
85
85
  }
86
86
  ]
87
87
  }
@@ -105,7 +105,7 @@
105
105
  "assertion": "toHaveAttribute",
106
106
  "attribute": "aria-expanded",
107
107
  "expectedValue": "true",
108
- "failureMessage": "Input's aria-expanded should be true after pressing ArrowDown."
108
+ "failureMessage": "Combobox input's aria-expanded should be true after pressing ArrowDown."
109
109
  },
110
110
  {
111
111
  "target": "input",
@@ -117,7 +117,7 @@
117
117
  ]
118
118
  },
119
119
  {
120
- "description": "Second ArrowDown press navigates to first option.",
120
+ "description": "Second ArrowDown press navigates to first listbox option.",
121
121
  "action": [
122
122
  { "type": "focus", "target": "input" },
123
123
  { "type": "keypress", "target": "input", "key": "ArrowDown" },
@@ -129,7 +129,7 @@
129
129
  "assertion": "toHaveAttribute",
130
130
  "attribute": "aria-activedescendant",
131
131
  "expectedValue": "!empty",
132
- "failureMessage": "Second ArrowDown should set first option as active descendant."
132
+ "failureMessage": "Second ArrowDown should set first listbox option as active descendant."
133
133
  },
134
134
  {
135
135
  "target": "relative",
@@ -137,12 +137,12 @@
137
137
  "attribute": "aria-selected",
138
138
  "expectedValue": "true",
139
139
  "relativeTarget": "first",
140
- "failureMessage": "First option should have aria-selected=true after second ArrowDown."
140
+ "failureMessage": "First listbox option should have aria-selected=true after second ArrowDown."
141
141
  }
142
142
  ]
143
143
  },
144
144
  {
145
- "description": "ArrowDown navigates to next option with wrapping.",
145
+ "description": "ArrowDown navigates to next listbox option with wrapping.",
146
146
  "action": [
147
147
  { "type": "focus", "target": "input" },
148
148
  { "type": "keypress", "target": "input", "key": "ArrowDown" },
@@ -156,7 +156,7 @@
156
156
  "attribute": "aria-selected",
157
157
  "expectedValue": "true",
158
158
  "relativeTarget": "second",
159
- "failureMessage": "Second option should be selected after third ArrowDown."
159
+ "failureMessage": "Second listbox option should be selected after third ArrowDown."
160
160
  }
161
161
  ]
162
162
  },
@@ -192,12 +192,12 @@
192
192
  "attribute": "aria-selected",
193
193
  "expectedValue": "true",
194
194
  "relativeTarget": "first",
195
- "failureMessage": "First option should be selected after navigating down then up."
195
+ "failureMessage": "First listbox option should be selected after navigating down then up."
196
196
  }
197
197
  ]
198
198
  },
199
199
  {
200
- "description": "Home key navigates to first option.",
200
+ "description": "Home key navigates to first listbox option.",
201
201
  "action": [
202
202
  { "type": "focus", "target": "input" },
203
203
  { "type": "keypress", "target": "input", "key": "ArrowDown" },
@@ -211,12 +211,12 @@
211
211
  "attribute": "aria-selected",
212
212
  "expectedValue": "true",
213
213
  "relativeTarget": "first",
214
- "failureMessage": "Home key should navigate to first option."
214
+ "failureMessage": "Home key should navigate to first listbox option."
215
215
  }
216
216
  ]
217
217
  },
218
218
  {
219
- "description": "End key navigates to last option.",
219
+ "description": "End key navigates to last listbox option.",
220
220
  "action": [
221
221
  { "type": "focus", "target": "input" },
222
222
  { "type": "keypress", "target": "input", "key": "ArrowDown" },
@@ -229,7 +229,7 @@
229
229
  "attribute": "aria-selected",
230
230
  "expectedValue": "true",
231
231
  "relativeTarget": "last",
232
- "failureMessage": "End key should navigate to last option."
232
+ "failureMessage": "End key should navigate to last listbox option."
233
233
  }
234
234
  ]
235
235
  },
@@ -252,13 +252,13 @@
252
252
  "assertion": "toHaveAttribute",
253
253
  "attribute": "aria-expanded",
254
254
  "expectedValue": "false",
255
- "failureMessage": "Input's aria-expanded should be false after selection."
255
+ "failureMessage": "Combobox input's aria-expanded should be false after selection."
256
256
  },
257
257
  {
258
258
  "target": "input",
259
259
  "assertion": "toHaveValue",
260
260
  "expectedValue": "!empty",
261
- "failureMessage": "Input should contain the selected option's text."
261
+ "failureMessage": "Combobox input should contain the selected option's text."
262
262
  }
263
263
  ]
264
264
  },
@@ -280,7 +280,7 @@
280
280
  "assertion": "toHaveAttribute",
281
281
  "attribute": "aria-expanded",
282
282
  "expectedValue": "false",
283
- "failureMessage": "Input's aria-expanded should be false after Escape."
283
+ "failureMessage": "Combobox input's aria-expanded should be false after Escape."
284
284
  }
285
285
  ]
286
286
  },
@@ -296,7 +296,7 @@
296
296
  "target": "input",
297
297
  "assertion": "toHaveValue",
298
298
  "expectedValue": "",
299
- "failureMessage": "Escape should clear input value when listbox is closed."
299
+ "failureMessage": "Escape should clear Combobox input value when listbox is closed."
300
300
  }
301
301
  ]
302
302
  },
@@ -335,18 +335,18 @@
335
335
  "assertion": "toHaveAttribute",
336
336
  "attribute": "aria-expanded",
337
337
  "expectedValue": "false",
338
- "failureMessage": "Input's aria-expanded should be false after clicking option."
338
+ "failureMessage": "Combobox input's aria-expanded should be false after clicking option."
339
339
  },
340
340
  {
341
341
  "target": "input",
342
342
  "assertion": "toHaveValue",
343
343
  "expectedValue": "!empty",
344
- "failureMessage": "Input should contain the clicked option's text."
344
+ "failureMessage": "Combobox input should contain the clicked option's text."
345
345
  }
346
346
  ]
347
347
  },
348
348
  {
349
- "description": "Mouse hover sets aria-selected on hovered option.",
349
+ "description": "Mouse hover sets aria-selected on hovered listbox option.",
350
350
  "requiresBrowser": true,
351
351
  "action": [
352
352
  { "type": "focus", "target": "input" },
@@ -360,7 +360,7 @@
360
360
  "attribute": "aria-selected",
361
361
  "expectedValue": "true",
362
362
  "relativeTarget": "second",
363
- "failureMessage": "Hovered option should have aria-selected=true."
363
+ "failureMessage": "Hovered listbox option should have aria-selected=true."
364
364
  }
365
365
  ]
366
366
  },
@@ -382,7 +382,7 @@
382
382
  "assertion": "toHaveAttribute",
383
383
  "attribute": "aria-expanded",
384
384
  "expectedValue": "false",
385
- "failureMessage": "Input's aria-expanded should be false after clicking outside."
385
+ "failureMessage": "Combobox input's aria-expanded should be false after clicking outside."
386
386
  }
387
387
  ]
388
388
  },
@@ -402,12 +402,12 @@
402
402
  "assertion": "toHaveAttribute",
403
403
  "attribute": "aria-expanded",
404
404
  "expectedValue": "true",
405
- "failureMessage": "Input's aria-expanded should be true after clicking button."
405
+ "failureMessage": "Combobox input's aria-expanded should be true after clicking button."
406
406
  },
407
407
  {
408
408
  "target": "input",
409
409
  "assertion": "toHaveFocus",
410
- "failureMessage": "Input should have focus after clicking toggle button."
410
+ "failureMessage": "Combobox input should have focus after clicking toggle button."
411
411
  }
412
412
  ]
413
413
  },
@@ -428,12 +428,12 @@
428
428
  "assertion": "toHaveAttribute",
429
429
  "attribute": "aria-expanded",
430
430
  "expectedValue": "false",
431
- "failureMessage": "Input's aria-expanded should be false after toggling closed."
431
+ "failureMessage": "Combobox input's aria-expanded should be false after toggling closed."
432
432
  }
433
433
  ]
434
434
  },
435
435
  {
436
- "description": "Navigation wraps from last to first option on ArrowDown.",
436
+ "description": "Navigation wraps from last to first listbox option on ArrowDown.",
437
437
  "action": [
438
438
  { "type": "focus", "target": "input" },
439
439
  { "type": "keypress", "target": "input", "key": "ArrowDown" },
@@ -447,12 +447,12 @@
447
447
  "attribute": "aria-selected",
448
448
  "expectedValue": "true",
449
449
  "relativeTarget": "first",
450
- "failureMessage": "Navigation should wrap from last to first option on ArrowDown."
450
+ "failureMessage": "Navigation should wrap from last to first listbox option on ArrowDown."
451
451
  }
452
452
  ]
453
453
  },
454
454
  {
455
- "description": "Navigation wraps from first to last option on ArrowUp.",
455
+ "description": "Navigation wraps from first to last listbox option on ArrowUp.",
456
456
  "action": [
457
457
  { "type": "focus", "target": "input" },
458
458
  { "type": "keypress", "target": "input", "key": "ArrowDown" },
@@ -466,9 +466,9 @@
466
466
  "attribute": "aria-selected",
467
467
  "expectedValue": "true",
468
468
  "relativeTarget": "last",
469
- "failureMessage": "Navigation should wrap from first to last option on ArrowUp."
469
+ "failureMessage": "Navigation should wrap from first to last listbox option on ArrowUp."
470
470
  }
471
471
  ]
472
472
  }
473
473
  ]
474
- }
474
+ }
@@ -34,14 +34,14 @@
34
34
  "assertion": "toHaveAttribute",
35
35
  "attribute": "aria-haspopup",
36
36
  "expectedValue": "true | menu",
37
- "failureMessage": "Menu trigger button doesn't conform to the ARIA Menu Button pattern as specified in APG 1.2. Menu button trigger should have 'aria-popup=true' attribute. This helps assistive technology to identify the button as one that toggles a panel div display."
37
+ "failureMessage": "Menu trigger button doesn't conform to the ARIA Menu Button pattern as specified in APG 1.2. Menu button trigger should have 'aria-haspopup=true | menu' attribute. This helps assistive technology to identify the button as one that toggles a panel div display."
38
38
  },
39
39
  {
40
40
  "target": "trigger",
41
41
  "assertion": "toHaveAttribute",
42
42
  "attribute": "aria-expanded",
43
43
  "expectedValue": "true | false",
44
- "failureMessage": "Menu trigger button doesn't conform to the ARIA Menu Button pattern as specified in APG 1.2. Menu trigger button should have 'aria-popup=true' attribute. This helps assistive technology to keep track of the open or close state of the menu panel div that the button controls."
44
+ "failureMessage": "Menu trigger button doesn't conform to the ARIA Menu Button pattern as specified in APG 1.2. Menu trigger button should have 'aria-expanded=true | false' attribute. This helps assistive technology to keep track of the open or close state of the menu panel div that the button controls."
45
45
  },
46
46
  {
47
47
  "target": "trigger",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aria-ease",
3
- "version": "2.9.0",
3
+ "version": "3.0.1",
4
4
  "description": "Out-of-the-box accessibility utility package to develop production ready applications.",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",