Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix(filter-field): Fixes an issue where the range stayed open when da…
Browse files Browse the repository at this point in the history
…tasource updated.

When the data is newly set, the currentDef of the filter field is reset. But because the range
overlay was open, it held the focus which meant that the stateChanges iteration was not executed,
as this only executes its logic when the filterfield has focus.

Relates to #1256
  • Loading branch information
tomheller authored and lukasholzer committed Jul 21, 2020
1 parent c6fe1fd commit d5fbe71
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libs/barista-components/filter-field/src/filter-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,16 @@ export class DtFilterField<T = any>
this._removeFilter(this._currentFilterValues);
this._currentFilterValues = [];
this._filterByLabel = '';

// If the current def is a range during the reset,
// we need to handle a couple of extra things about the range, i.e.
// closing it and restoring the focus.
if (isDtRangeDef(this._currentDef)) {
if (this._filterfieldRange.isOpen) {
this._filterfieldRangeTrigger.closePanel();
this.focus();
}
}
}
this._currentDef = def;
this._updateControl();
Expand Down

0 comments on commit d5fbe71

Please sign in to comment.