Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/aria/private/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,36 +205,39 @@ export class TreePattern<V> {
/** Whether the tree selection follows focus. */
readonly followFocus = computed(() => this.inputs.selectionMode() === 'follow');

/** Whether the tree direction is RTL. */
readonly isRtl = computed(() => this.inputs.textDirection() === 'rtl');

/** The key for navigating to the previous item. */
readonly prevKey = computed(() => {
if (this.inputs.orientation() === 'vertical') {
return 'ArrowUp';
}
return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
return this.isRtl() ? 'ArrowRight' : 'ArrowLeft';
});

/** The key for navigating to the next item. */
readonly nextKey = computed(() => {
if (this.inputs.orientation() === 'vertical') {
return 'ArrowDown';
}
return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
return this.isRtl() ? 'ArrowLeft' : 'ArrowRight';
});

/** The key for collapsing an item or moving to its parent. */
readonly collapseKey = computed(() => {
if (this.inputs.orientation() === 'horizontal') {
return 'ArrowUp';
}
return this.inputs.textDirection() === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
return this.isRtl() ? 'ArrowRight' : 'ArrowLeft';
});

/** The key for expanding an item or moving to its first child. */
readonly expandKey = computed(() => {
if (this.inputs.orientation() === 'horizontal') {
return 'ArrowDown';
}
return this.inputs.textDirection() === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
return this.isRtl() ? 'ArrowLeft' : 'ArrowRight';
});

/** Represents the space key. Does nothing when the user is actively using typeahead. */
Expand Down
Loading