@headless-tree/core 0.0.0-20251208193155 → 0.0.0-20251210132907

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @headless-tree/core
2
2
 
3
- ## 0.0.0-20251208193155
3
+ ## 0.0.0-20251210132907
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -8,6 +8,7 @@
8
8
 
9
9
  ### Patch Changes
10
10
 
11
+ - 287fe40: Added missing `aria-expanded` attribute to tree items (thanks to @gordey4doronin for the contribution) (#171)
11
12
  - 7158afe: Improve rerendering behavior by skipping changes to the item loading state when items are already loading, and skipping changes to loading state in case of checkbox click propagation if items are loaded immediately (#173)
12
13
 
13
14
  ## 1.5.1
package/dist/index.js CHANGED
@@ -251,6 +251,7 @@ var treeFeature = {
251
251
  "aria-selected": "false",
252
252
  "aria-label": item.getItemName(),
253
253
  "aria-level": itemMeta.level + 1,
254
+ "aria-expanded": item.isFolder() ? item.isExpanded() : void 0,
254
255
  tabIndex: item.isFocused() ? 0 : -1,
255
256
  onClick: (e) => {
256
257
  item.setFocused();
package/dist/index.mjs CHANGED
@@ -207,6 +207,7 @@ var treeFeature = {
207
207
  "aria-selected": "false",
208
208
  "aria-label": item.getItemName(),
209
209
  "aria-level": itemMeta.level + 1,
210
+ "aria-expanded": item.isFolder() ? item.isExpanded() : void 0,
210
211
  tabIndex: item.isFocused() ? 0 : -1,
211
212
  onClick: (e) => {
212
213
  item.setFocused();
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "checkbox",
14
14
  "hook"
15
15
  ],
16
- "version": "0.0.0-20251208193155",
16
+ "version": "0.0.0-20251210132907",
17
17
  "main": "dist/index.d.ts",
18
18
  "module": "dist/index.mjs",
19
19
  "types": "dist/index.d.mts",
@@ -144,6 +144,7 @@ export const treeFeature: FeatureImplementation<any> = {
144
144
  "aria-selected": "false",
145
145
  "aria-label": item.getItemName(),
146
146
  "aria-level": itemMeta.level + 1,
147
+ "aria-expanded": item.isFolder() ? item.isExpanded() : undefined,
147
148
  tabIndex: item.isFocused() ? 0 : -1,
148
149
  onClick: (e: MouseEvent) => {
149
150
  item.setFocused();
@@ -250,6 +250,7 @@ describe("core-feature/tree", () => {
250
250
  "aria-posinset": 2,
251
251
  "aria-selected": "false",
252
252
  "aria-setsize": 4,
253
+ "aria-expanded": false,
253
254
  onClick: expect.any(Function),
254
255
  ref: expect.any(Function),
255
256
  role: "treeitem",
@@ -264,12 +265,29 @@ describe("core-feature/tree", () => {
264
265
  "aria-posinset": 1,
265
266
  "aria-selected": "false",
266
267
  "aria-setsize": 4,
268
+ "aria-expanded": true,
267
269
  onClick: expect.any(Function),
268
270
  ref: expect.any(Function),
269
271
  role: "treeitem",
270
272
  tabIndex: 0,
271
273
  });
272
274
  });
275
+
276
+ it("generates aria-expanded for non expanded folder", () => {
277
+ expect(tree.instance.getItemInstance("x3").getProps()).toEqual(
278
+ expect.objectContaining({
279
+ "aria-expanded": false,
280
+ }),
281
+ );
282
+ });
283
+
284
+ it("generates aria-expanded for leaf", () => {
285
+ expect(tree.instance.getItemInstance("x111").getProps()).toEqual(
286
+ expect.objectContaining({
287
+ "aria-expanded": undefined,
288
+ }),
289
+ );
290
+ });
273
291
  });
274
292
 
275
293
  describe("util functions", () => {