Skip to content

Commit cb956b8

Browse files
authored
fix(multiple): change delays to use ms (#32321)
* fix(multiple): change delays to use ms * fixup! fix(multiple): change delays to use ms
1 parent 3b39d89 commit cb956b8

File tree

12 files changed

+21
-21
lines changed

12 files changed

+21
-21
lines changed

src/aria/listbox/listbox.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ describe('Listbox', () => {
724724
});
725725

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

729729
type('A');
730730
expect(isFocused(1)).toBe(true);
@@ -817,7 +817,7 @@ class ListboxExample {
817817
multi = false;
818818
wrap = true;
819819
selectionMode: 'follow' | 'explicit' = 'explicit';
820-
typeaheadDelay = 0.5;
820+
typeaheadDelay = 500;
821821
}
822822

823823
@Component({

src/aria/listbox/listbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class Listbox<V> {
123123
selectionMode = input<'follow' | 'explicit'>('follow');
124124

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

128128
/** Whether the listbox is disabled. */
129129
disabled = input(false, {transform: booleanAttribute});

src/aria/menu/menu.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ export class Menu<V> {
192192
/** Whether the menu should wrap its items. */
193193
readonly wrap = input(true, {transform: booleanAttribute});
194194

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

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

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

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

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

350350
/** The menu ui pattern instance. */
351351
readonly _pattern: MenuBarPattern<V>;

src/aria/private/behaviors/list-typeahead/list-typeahead.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function getTypeahead(inputs: TestInputs = {}): ListTypeahead<TestItem> {
2626
focusManager,
2727
...focusManager.inputs,
2828
items,
29-
typeaheadDelay: signal(0.5),
29+
typeaheadDelay: signal(500),
3030
...inputs,
3131
});
3232
}

src/aria/private/behaviors/list-typeahead/list-typeahead.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class ListTypeahead<T extends ListTypeaheadItem> {
7474
this.timeout = setTimeout(() => {
7575
this._query.set('');
7676
this._startIndex.set(undefined);
77-
}, this.inputs.typeaheadDelay() * 1000);
77+
}, this.inputs.typeaheadDelay());
7878

7979
return true;
8080
}

src/aria/private/behaviors/list/list.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('List Behavior', () => {
2424
return new List({
2525
values: inputs.values ?? signal([]),
2626
activeItem: signal(undefined),
27-
typeaheadDelay: inputs.typeaheadDelay ?? signal(0.5),
27+
typeaheadDelay: inputs.typeaheadDelay ?? signal(500),
2828
wrap: inputs.wrap ?? signal(true),
2929
disabled: inputs.disabled ?? signal(false),
3030
multi: inputs.multi ?? signal(false),
@@ -390,7 +390,7 @@ describe('List Behavior', () => {
390390
});
391391

392392
it('should respect typeaheadDelay', async () => {
393-
const {list} = getDefaultPatterns({typeaheadDelay: signal(0.1)});
393+
const {list} = getDefaultPatterns({typeaheadDelay: signal(100)});
394394
list.search('b');
395395
expect(list.inputs.activeItem()).toBe(list.inputs.items()[2]); // Banana
396396
await delay(50); // Less than delay

src/aria/private/combobox/combobox.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function getListboxPattern(
125125
values: signal(initialValue ? [initialValue] : []),
126126
combobox: signal(combobox) as any,
127127
activeItem: signal(undefined),
128-
typeaheadDelay: signal(0.5),
128+
typeaheadDelay: signal(500),
129129
wrap: signal(true),
130130
readonly: signal(false),
131131
disabled: signal(false),
@@ -169,7 +169,7 @@ function getTreePattern(
169169
values: signal(initialValue ? [initialValue] : []),
170170
combobox: signal(combobox) as any,
171171
activeItem: signal(undefined),
172-
typeaheadDelay: signal(0.5),
172+
typeaheadDelay: signal(500),
173173
wrap: signal(true),
174174
disabled: signal(false),
175175
softDisabled: signal(true),

src/aria/private/listbox/listbox.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Listbox Pattern', () => {
3636
items: inputs.items,
3737
values: inputs.values ?? signal([]),
3838
activeItem: signal(undefined),
39-
typeaheadDelay: inputs.typeaheadDelay ?? signal(0.5),
39+
typeaheadDelay: inputs.typeaheadDelay ?? signal(500),
4040
wrap: inputs.wrap ?? signal(true),
4141
readonly: inputs.readonly ?? signal(false),
4242
disabled: inputs.disabled ?? signal(false),

src/aria/private/menu/menu.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function getMenuBarPattern(values: string[], opts?: {textDirection: 'ltr' | 'rtl
6161
selectionMode: signal('explicit'),
6262
values: signal([]),
6363
wrap: signal(true),
64-
typeaheadDelay: signal(0.5),
64+
typeaheadDelay: signal(500),
6565
softDisabled: signal(true),
6666
focusMode: signal('activedescendant'),
6767
element: signal(document.createElement('div')),
@@ -99,7 +99,7 @@ function getMenuPattern(
9999
items: items,
100100
parent: signal(parent) as any,
101101
activeItem: signal(undefined),
102-
typeaheadDelay: signal(0.5),
102+
typeaheadDelay: signal(500),
103103
wrap: signal(true),
104104
softDisabled: signal(true),
105105
multi: signal(false),

src/aria/private/menu/menu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class MenuPattern<V> {
232232
this._closeTimeout = setTimeout(() => {
233233
item.close();
234234
this._closeTimeout = undefined;
235-
}, this.inputs.expansionDelay() * 1000);
235+
}, this.inputs.expansionDelay());
236236
}
237237
}
238238

@@ -243,7 +243,7 @@ export class MenuPattern<V> {
243243
this._openTimeout = setTimeout(() => {
244244
item.open();
245245
this._openTimeout = undefined;
246-
}, this.inputs.expansionDelay() * 1000);
246+
}, this.inputs.expansionDelay());
247247
}
248248

249249
/** Handles mouseout events for the menu. */

0 commit comments

Comments
 (0)