Skip to content

Commit 2138d26

Browse files
committed
fix(aria/ui-patterns): internal conformance fixes
1 parent e66f1ca commit 2138d26

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

src/aria/ui-patterns/accordion/accordion.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ export class AccordionTriggerPattern {
116116
this.id = inputs.id;
117117
this.element = inputs.element;
118118
this.value = inputs.value;
119-
this.accordionGroup = inputs.accordionGroup;
120-
this.accordionPanel = inputs.accordionPanel;
121119
this.expansionControl = new ExpansionControl({
122120
...inputs,
123121
expansionId: inputs.value,
@@ -148,10 +146,10 @@ export class AccordionTriggerPattern {
148146
/** The keydown event manager for the accordion trigger. */
149147
keydown = computed(() => {
150148
return new KeyboardEventManager()
151-
.on(this.prevKey, () => this.accordionGroup().navigation.prev())
152-
.on(this.nextKey, () => this.accordionGroup().navigation.next())
153-
.on('Home', () => this.accordionGroup().navigation.first())
154-
.on('End', () => this.accordionGroup().navigation.last())
149+
.on(this.prevKey, () => this.inputs.accordionGroup().navigation.prev())
150+
.on(this.nextKey, () => this.inputs.accordionGroup().navigation.next())
151+
.on('Home', () => this.inputs.accordionGroup().navigation.first())
152+
.on('End', () => this.inputs.accordionGroup().navigation.last())
155153
.on(' ', () => this.expansionControl.toggle())
156154
.on('Enter', () => this.expansionControl.toggle());
157155
});
@@ -162,7 +160,7 @@ export class AccordionTriggerPattern {
162160
const item = this._getItem(e);
163161

164162
if (item) {
165-
this.accordionGroup().navigation.goto(item);
163+
this.inputs.accordionGroup().navigation.goto(item);
166164
this.expansionControl.toggle();
167165
}
168166
});
@@ -183,7 +181,7 @@ export class AccordionTriggerPattern {
183181
const item = this._getItem(event);
184182

185183
if (item && this.inputs.accordionGroup().focusManager.isFocusable(item)) {
186-
this.accordionGroup().focusManager.focus(item);
184+
this.inputs.accordionGroup().focusManager.focus(item);
187185
}
188186
}
189187

@@ -193,7 +191,8 @@ export class AccordionTriggerPattern {
193191
}
194192

195193
const element = e.target.closest('[role="button"]');
196-
return this.accordionGroup()
194+
return this.inputs
195+
.accordionGroup()
197196
.items()
198197
.find(i => i.element() === element);
199198
}

src/aria/ui-patterns/tree/combobox-tree.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class ComboboxTreePattern<V>
2121
implements ComboboxTreeControls<TreeItemPattern<V>, V>
2222
{
2323
/** Whether the currently focused item is collapsible. */
24-
isItemCollapsible = () => this.activeItem()?.parent() instanceof TreeItemPattern;
24+
isItemCollapsible = () => this.inputs.activeItem()?.parent() instanceof TreeItemPattern;
2525

2626
/** The ARIA role for the tree. */
2727
role = () => 'tree' as const;
@@ -94,7 +94,7 @@ export class ComboboxTreePattern<V>
9494
collapseItem = () => this.collapse();
9595

9696
/** Whether the specified item or the currently active item is expandable. */
97-
isItemExpandable(item: TreeItemPattern<V> | undefined = this.activeItem()) {
97+
isItemExpandable(item: TreeItemPattern<V> | undefined = this.inputs.activeItem()) {
9898
return item ? item.expandable() : false;
9999
}
100100

src/aria/ui-patterns/tree/tree.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,30 @@ export class TreeItemPattern<V> implements ExpansionItem {
8484
return this.tree().value().includes(this.value()) ? this.tree().currentType() : undefined;
8585
});
8686

87+
/** A unique identifier for this item. */
88+
id: SignalLike<string>;
89+
90+
/** The value of this item. */
91+
value: SignalLike<V>;
92+
93+
/** A reference to the item element. */
94+
element: SignalLike<HTMLElement>;
95+
96+
/** Whether the item is disabled. */
97+
disabled: SignalLike<boolean>;
98+
99+
/** The text used by the typeahead search. */
100+
searchTerm: SignalLike<string>;
101+
102+
/** The tree pattern this item belongs to. */
103+
tree: SignalLike<TreePattern<V>>;
104+
105+
/** The parent item. */
106+
parent: SignalLike<TreeItemPattern<V> | TreePattern<V>>;
107+
108+
/** The children items. */
109+
children: SignalLike<TreeItemPattern<V>[]>;
110+
87111
constructor(readonly inputs: TreeItemInputs<V>) {
88112
this.id = inputs.id;
89113
this.value = inputs.value;

0 commit comments

Comments
 (0)