mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix click-based selection of typeahead suggestion
In short, the underlying problem appears to be the `onChange()` handler being triggered after handling the blur event. Since the contents have not actually changed this forces the typeahead state to reset which undesirably puts a stop to propagating the selected suggestion back up to get set. Related: #13604
This commit is contained in:
@@ -198,7 +198,7 @@ class QueryField extends React.PureComponent<TypeaheadFieldProps, TypeaheadField
|
|||||||
if (textChanged && value.selection.isCollapsed) {
|
if (textChanged && value.selection.isCollapsed) {
|
||||||
// Need one paint to allow DOM-based typeahead rules to work
|
// Need one paint to allow DOM-based typeahead rules to work
|
||||||
window.requestAnimationFrame(this.handleTypeahead);
|
window.requestAnimationFrame(this.handleTypeahead);
|
||||||
} else {
|
} else if (!this.resetTimer) {
|
||||||
this.resetTypeahead();
|
this.resetTypeahead();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -402,6 +402,7 @@ class QueryField extends React.PureComponent<TypeaheadFieldProps, TypeaheadField
|
|||||||
typeaheadPrefix: '',
|
typeaheadPrefix: '',
|
||||||
typeaheadContext: null,
|
typeaheadContext: null,
|
||||||
});
|
});
|
||||||
|
this.resetTimer = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
handleBlur = () => {
|
handleBlur = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user