Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { JsonField } from './JsonField';
import { NumberField } from './NumberField';
import { StringField } from './StringField';

const noop = () => {};

export const IntellisenseTextField: React.FC<FieldProps<string>> = (props) => {
const { id, value = '', onChange, uiOptions, focused: defaultFocused } = props;

Expand Down Expand Up @@ -39,7 +41,7 @@ export const IntellisenseTextField: React.FC<FieldProps<string>> = (props) => {
focused={focused}
id={id}
value={textFieldValue}
onBlur={() => {}} // onBlur managed by Intellisense
onBlur={noop} // onBlur managed by Intellisense
onChange={(newValue) => onValueChanged(newValue || '')}
onClick={onClickTextField}
onKeyDown={onKeyDownTextField}
Expand Down Expand Up @@ -72,7 +74,7 @@ export const IntellisenseExpressionField: React.FC<FieldProps<string>> = (props)
focused={focused}
id={id}
value={textFieldValue}
onBlur={() => {}} // onBlur managed by Intellisense
onBlur={noop} // onBlur managed by Intellisense
onChange={(newValue) => onValueChanged(newValue || '')}
onClick={onClickTextField}
onKeyDown={onKeyDownTextField}
Expand Down Expand Up @@ -110,7 +112,7 @@ export const IntellisenseNumberField: React.FC<FieldProps<string>> = (props) =>
focused={focused}
id={id}
value={textFieldValue}
onBlur={() => {}} // onBlur managed by Intellisense
onBlur={noop} // onBlur managed by Intellisense
onChange={(newValue) => onValueChanged(newValue || 0)}
onClick={onClickTextField}
onKeyDown={onKeyDownTextField}
Expand Down Expand Up @@ -167,7 +169,7 @@ export const IntellisenseJSONField: React.FC<FieldProps<string>> = (props) => {
{...props}
style={{ height: 100 }}
value={textFieldValue}
onBlur={() => {}} // onBlur managed by Intellisense
onBlur={noop} // onBlur managed by Intellisense
onChange={onValueChanged}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const Intellisense = React.memo(
const outsideClickHandler = (event: MouseEvent) => {
const { x, y } = event;

let shouldBlur = true;
let shouldBlur = focused;

if (mainContainerRef.current && !checkIsOutside(x, y, mainContainerRef.current)) {
shouldBlur = false;
Expand All @@ -98,7 +98,7 @@ export const Intellisense = React.memo(
};

const keyupHandler = (event: KeyboardEvent) => {
if (event.key === 'Escape') {
if (event.key === 'Escape' && focused) {
setShowCompletionList(false);
onBlur && onBlur(id);
}
Expand All @@ -111,7 +111,7 @@ export const Intellisense = React.memo(
document.body.removeEventListener('click', outsideClickHandler);
document.body.removeEventListener('keyup', keyupHandler);
};
}, []);
}, [focused, onBlur]);

// When textField value is changed
const onValueChanged = (newValue: string) => {
Expand Down