Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/aria/listbox/listbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ describe('Listbox', () => {
});

it('should reset search term after typeaheadDelay', async () => {
setupListbox({options: getOptions(), focusMode, typeaheadDelay: 0.1});
setupListbox({options: getOptions(), focusMode, typeaheadDelay: 100});

type('A');
expect(isFocused(1)).toBe(true);
Expand Down Expand Up @@ -817,7 +817,7 @@ class ListboxExample {
multi = false;
wrap = true;
selectionMode: 'follow' | 'explicit' = 'explicit';
typeaheadDelay = 0.5;
typeaheadDelay = 500;
}

@Component({
Expand Down
2 changes: 1 addition & 1 deletion src/aria/listbox/listbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class Listbox<V> {
selectionMode = input<'follow' | 'explicit'>('follow');

/** The amount of time before the typeahead search is reset. */
typeaheadDelay = input<number>(0.5); // Picked arbitrarily.
typeaheadDelay = input<number>(500); // Picked arbitrarily.

/** Whether the listbox is disabled. */
disabled = input(false, {transform: booleanAttribute});
Expand Down
12 changes: 6 additions & 6 deletions src/aria/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ export class Menu<V> {
/** Whether the menu should wrap its items. */
readonly wrap = input(true, {transform: booleanAttribute});

/** The delay in seconds before the typeahead buffer is cleared. */
readonly typeaheadDelay = input<number>(0.5); // Picked arbitrarily.
/** The delay in milliseconds before the typeahead buffer is cleared. */
readonly typeaheadDelay = input<number>(500); // Picked arbitrarily.

/** Whether the menu is disabled. */
readonly disabled = input(false, {transform: booleanAttribute});
Expand Down Expand Up @@ -222,8 +222,8 @@ export class Menu<V> {
/** A callback function triggered when a menu item is selected. */
onSelect = output<V>();

/** The delay in seconds before expanding sub-menus on hover. */
readonly expansionDelay = input<number>(0.1); // Arbitrarily chosen.
/** The delay in milliseconds before expanding sub-menus on hover. */
readonly expansionDelay = input<number>(100); // Arbitrarily chosen.

constructor() {
this._pattern = new MenuPattern({
Expand Down Expand Up @@ -344,8 +344,8 @@ export class MenuBar<V> {
/** Whether the menu should wrap its items. */
readonly wrap = input(true, {transform: booleanAttribute});

/** The delay in seconds before the typeahead buffer is cleared. */
readonly typeaheadDelay = input<number>(0.5);
/** The delay in milliseconds before the typeahead buffer is cleared. */
readonly typeaheadDelay = input<number>(500);

/** The menu ui pattern instance. */
readonly _pattern: MenuBarPattern<V>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function getTypeahead(inputs: TestInputs = {}): ListTypeahead<TestItem> {
focusManager,
...focusManager.inputs,
items,
typeaheadDelay: signal(0.5),
typeaheadDelay: signal(500),
...inputs,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class ListTypeahead<T extends ListTypeaheadItem> {
this.timeout = setTimeout(() => {
this._query.set('');
this._startIndex.set(undefined);
}, this.inputs.typeaheadDelay() * 1000);
}, this.inputs.typeaheadDelay());

return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/aria/private/behaviors/list/list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('List Behavior', () => {
return new List({
values: inputs.values ?? signal([]),
activeItem: signal(undefined),
typeaheadDelay: inputs.typeaheadDelay ?? signal(0.5),
typeaheadDelay: inputs.typeaheadDelay ?? signal(500),
wrap: inputs.wrap ?? signal(true),
disabled: inputs.disabled ?? signal(false),
multi: inputs.multi ?? signal(false),
Expand Down Expand Up @@ -390,7 +390,7 @@ describe('List Behavior', () => {
});

it('should respect typeaheadDelay', async () => {
const {list} = getDefaultPatterns({typeaheadDelay: signal(0.1)});
const {list} = getDefaultPatterns({typeaheadDelay: signal(100)});
list.search('b');
expect(list.inputs.activeItem()).toBe(list.inputs.items()[2]); // Banana
await delay(50); // Less than delay
Expand Down
4 changes: 2 additions & 2 deletions src/aria/private/combobox/combobox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function getListboxPattern(
values: signal(initialValue ? [initialValue] : []),
combobox: signal(combobox) as any,
activeItem: signal(undefined),
typeaheadDelay: signal(0.5),
typeaheadDelay: signal(500),
wrap: signal(true),
readonly: signal(false),
disabled: signal(false),
Expand Down Expand Up @@ -169,7 +169,7 @@ function getTreePattern(
values: signal(initialValue ? [initialValue] : []),
combobox: signal(combobox) as any,
activeItem: signal(undefined),
typeaheadDelay: signal(0.5),
typeaheadDelay: signal(500),
wrap: signal(true),
disabled: signal(false),
softDisabled: signal(true),
Expand Down
2 changes: 1 addition & 1 deletion src/aria/private/listbox/listbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Listbox Pattern', () => {
items: inputs.items,
values: inputs.values ?? signal([]),
activeItem: signal(undefined),
typeaheadDelay: inputs.typeaheadDelay ?? signal(0.5),
typeaheadDelay: inputs.typeaheadDelay ?? signal(500),
wrap: inputs.wrap ?? signal(true),
readonly: inputs.readonly ?? signal(false),
disabled: inputs.disabled ?? signal(false),
Expand Down
4 changes: 2 additions & 2 deletions src/aria/private/menu/menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function getMenuBarPattern(values: string[], opts?: {textDirection: 'ltr' | 'rtl
selectionMode: signal('explicit'),
values: signal([]),
wrap: signal(true),
typeaheadDelay: signal(0.5),
typeaheadDelay: signal(500),
softDisabled: signal(true),
focusMode: signal('activedescendant'),
element: signal(document.createElement('div')),
Expand Down Expand Up @@ -99,7 +99,7 @@ function getMenuPattern(
items: items,
parent: signal(parent) as any,
activeItem: signal(undefined),
typeaheadDelay: signal(0.5),
typeaheadDelay: signal(500),
wrap: signal(true),
softDisabled: signal(true),
multi: signal(false),
Expand Down
4 changes: 2 additions & 2 deletions src/aria/private/menu/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class MenuPattern<V> {
this._closeTimeout = setTimeout(() => {
item.close();
this._closeTimeout = undefined;
}, this.inputs.expansionDelay() * 1000);
}, this.inputs.expansionDelay());
}
}

Expand All @@ -243,7 +243,7 @@ export class MenuPattern<V> {
this._openTimeout = setTimeout(() => {
item.open();
this._openTimeout = undefined;
}, this.inputs.expansionDelay() * 1000);
}, this.inputs.expansionDelay());
}

/** Handles mouseout events for the menu. */
Expand Down
2 changes: 1 addition & 1 deletion src/aria/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class Tree<V> {
readonly softDisabled = input(true, {transform: booleanAttribute});

/** The delay in seconds before the typeahead search is reset. */
readonly typeaheadDelay = input(0.5);
readonly typeaheadDelay = input(500);

/** The values of the currently selected items. */
readonly values = model<V[]>([]);
Expand Down
Empty file.
Loading