@headless-tree/core 0.0.0-20250630160730 → 0.0.0-20250716232056
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
|
@@ -107,7 +107,7 @@ exports.treeFeature = {
|
|
|
107
107
|
getKey: ({ itemId }) => itemId, // TODO apply to all stories to use
|
|
108
108
|
getProps: ({ item, prev }) => {
|
|
109
109
|
const itemMeta = item.getItemMeta();
|
|
110
|
-
return Object.assign(Object.assign({}, prev === null || prev === void 0 ? void 0 : prev()), { ref: item.registerElement, role: "treeitem", "aria-setsize": itemMeta.setSize, "aria-posinset": itemMeta.posInSet, "aria-selected": "false", "aria-label": item.getItemName(), "aria-level": itemMeta.level, tabIndex: item.isFocused() ? 0 : -1, onClick: (e) => {
|
|
110
|
+
return Object.assign(Object.assign({}, prev === null || prev === void 0 ? void 0 : prev()), { ref: item.registerElement, role: "treeitem", "aria-setsize": itemMeta.setSize, "aria-posinset": itemMeta.posInSet + 1, "aria-selected": "false", "aria-label": item.getItemName(), "aria-level": itemMeta.level + 1, tabIndex: item.isFocused() ? 0 : -1, onClick: (e) => {
|
|
111
111
|
item.setFocused();
|
|
112
112
|
item.primaryAction();
|
|
113
113
|
if (e.ctrlKey || e.shiftKey || e.metaKey) {
|
|
@@ -104,7 +104,7 @@ export const treeFeature = {
|
|
|
104
104
|
getKey: ({ itemId }) => itemId, // TODO apply to all stories to use
|
|
105
105
|
getProps: ({ item, prev }) => {
|
|
106
106
|
const itemMeta = item.getItemMeta();
|
|
107
|
-
return Object.assign(Object.assign({}, prev === null || prev === void 0 ? void 0 : prev()), { ref: item.registerElement, role: "treeitem", "aria-setsize": itemMeta.setSize, "aria-posinset": itemMeta.posInSet, "aria-selected": "false", "aria-label": item.getItemName(), "aria-level": itemMeta.level, tabIndex: item.isFocused() ? 0 : -1, onClick: (e) => {
|
|
107
|
+
return Object.assign(Object.assign({}, prev === null || prev === void 0 ? void 0 : prev()), { ref: item.registerElement, role: "treeitem", "aria-setsize": itemMeta.setSize, "aria-posinset": itemMeta.posInSet + 1, "aria-selected": "false", "aria-label": item.getItemName(), "aria-level": itemMeta.level + 1, tabIndex: item.isFocused() ? 0 : -1, onClick: (e) => {
|
|
108
108
|
item.setFocused();
|
|
109
109
|
item.primaryAction();
|
|
110
110
|
if (e.ctrlKey || e.shiftKey || e.metaKey) {
|
package/package.json
CHANGED
|
@@ -139,10 +139,10 @@ export const treeFeature: FeatureImplementation<any> = {
|
|
|
139
139
|
ref: item.registerElement,
|
|
140
140
|
role: "treeitem",
|
|
141
141
|
"aria-setsize": itemMeta.setSize,
|
|
142
|
-
"aria-posinset": itemMeta.posInSet,
|
|
142
|
+
"aria-posinset": itemMeta.posInSet + 1,
|
|
143
143
|
"aria-selected": "false",
|
|
144
144
|
"aria-label": item.getItemName(),
|
|
145
|
-
"aria-level": itemMeta.level,
|
|
145
|
+
"aria-level": itemMeta.level + 1,
|
|
146
146
|
tabIndex: item.isFocused() ? 0 : -1,
|
|
147
147
|
onClick: (e: MouseEvent) => {
|
|
148
148
|
item.setFocused();
|
|
@@ -235,8 +235,8 @@ describe("core-feature/selections", () => {
|
|
|
235
235
|
it("generates item props for random item", () => {
|
|
236
236
|
expect(tree.instance.getItemInstance("x2").getProps()).toEqual({
|
|
237
237
|
"aria-label": "x2",
|
|
238
|
-
"aria-level":
|
|
239
|
-
"aria-posinset":
|
|
238
|
+
"aria-level": 1,
|
|
239
|
+
"aria-posinset": 2,
|
|
240
240
|
"aria-selected": "false",
|
|
241
241
|
"aria-setsize": 4,
|
|
242
242
|
onClick: expect.any(Function),
|
|
@@ -249,8 +249,8 @@ describe("core-feature/selections", () => {
|
|
|
249
249
|
it("generates item props for focused", () => {
|
|
250
250
|
expect(tree.instance.getItemInstance("x1").getProps()).toEqual({
|
|
251
251
|
"aria-label": "x1",
|
|
252
|
-
"aria-level":
|
|
253
|
-
"aria-posinset":
|
|
252
|
+
"aria-level": 1,
|
|
253
|
+
"aria-posinset": 1,
|
|
254
254
|
"aria-selected": "false",
|
|
255
255
|
"aria-setsize": 4,
|
|
256
256
|
onClick: expect.any(Function),
|