diff --git a/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Seg.tsx b/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Seg.tsx
index b77285e9ac2..b7d125eca77 100644
--- a/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Seg.tsx
+++ b/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Seg.tsx
@@ -137,22 +137,23 @@ const Sel = ({ loadOptions, filterByLoadOptions, allowCustomValue, onChange, onC
type InpProps = {
initialValue: string;
onChange: (newVal: string) => void;
+ onClose: () => void;
};
-const Inp = ({ initialValue, onChange }: InpProps): JSX.Element => {
+const Inp = ({ initialValue, onChange, onClose }: InpProps): JSX.Element => {
const [currentValue, setCurrentValue] = useShadowedState(initialValue);
- const onBlur = () => {
- // we send empty-string as undefined
- onChange(currentValue);
- };
-
return (
{
+ if (e.key === 'Enter') {
+ onChange(currentValue);
+ }
+ }}
onChange={(e) => {
setCurrentValue(e.currentTarget.value);
}}
@@ -208,6 +209,9 @@ export const Seg = ({
return (
{
+ setOpen(false);
+ }}
onChange={(v) => {
setOpen(false);
onChange({ value: v, label: v });