Skip to content

Commit 8c56d06

Browse files
crisbetowagnermaciel
authored andcommitted
fix(material/select): incorrect default typeahead debounce time (#21253)
In 17a9ad0 so logic was added that was setting the typeahead debounce interval to 0 if it isn't specified globally. This is incorrect, because we want it to stay undefined so the list key manager can fall back to its default interval. Fixes #21242. (cherry picked from commit ab01f38)
1 parent dbae066 commit 8c56d06

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/material/select/select.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ export abstract class _MatSelectBase<C> extends _MatSelectMixinBase implements A
427427
set typeaheadDebounceInterval(value: number) {
428428
this._typeaheadDebounceInterval = coerceNumberProperty(value);
429429
}
430-
private _typeaheadDebounceInterval = this._defaultOptions?.typeaheadDebounceInterval ?? 0;
430+
private _typeaheadDebounceInterval: number;
431431

432432
/**
433433
* Function used to sort the values in a select in multiple mode.
@@ -504,6 +504,12 @@ export abstract class _MatSelectBase<C> extends _MatSelectMixinBase implements A
504504
this.ngControl.valueAccessor = this;
505505
}
506506

507+
// Note that we only want to set this when the defaults pass it in, otherwise it should
508+
// stay as `undefined` so that it falls back to the default in the key manager.
509+
if (_defaultOptions?.typeaheadDebounceInterval != null) {
510+
this._typeaheadDebounceInterval = _defaultOptions.typeaheadDebounceInterval;
511+
}
512+
507513
this._scrollStrategyFactory = scrollStrategyFactory;
508514
this._scrollStrategy = this._scrollStrategyFactory();
509515
this.tabIndex = parseInt(tabIndex) || 0;

0 commit comments

Comments
 (0)