Variables: Prevents enter key from refreshing page or changing focus (#39666) (#39697)

(cherry picked from commit 9a178e7ba9)

Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2021-09-28 06:41:28 +02:00
committed by GitHub
co-authored by Hugo Häggmark
parent 06cb288848
commit 6c92beb7fe
@@ -46,6 +46,7 @@ export function TextBoxVariablePicker({ variable, onVariableChange }: Props): Re
const onBlur = (e: FocusEvent<HTMLInputElement>) => updateVariable();
const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
if (event.keyCode === 13) {
event.preventDefault();
updateVariable();
}
};