diff --git a/frontend/src/lib/components/SmartNodeSelector/private-components/suggestions.tsx b/frontend/src/lib/components/SmartNodeSelector/private-components/suggestions.tsx index d70127515..2e9483dd5 100644 --- a/frontend/src/lib/components/SmartNodeSelector/private-components/suggestions.tsx +++ b/frontend/src/lib/components/SmartNodeSelector/private-components/suggestions.tsx @@ -98,7 +98,12 @@ export class Suggestions extends React.Component { componentDidUpdate(previousProps: SuggestionsProps): void { const { visible, treeNodeSelection, suggestionsRef } = this.props; - if (previousProps.visible != visible || previousProps.treeNodeSelection != treeNodeSelection) { + if (previousProps.visible !== visible || previousProps.treeNodeSelection !== treeNodeSelection) { + if (this.props.treeNodeSelection) { + this._allOptions = this.props.treeNodeSelection.getSuggestions(); + this._currentNodeLevel = this.props.treeNodeSelection.getFocussedLevel(); + } + this._upperSpacerHeight = 0; if (suggestionsRef.current) { (suggestionsRef.current as HTMLDivElement).scrollTop = 0; @@ -144,7 +149,7 @@ export class Suggestions extends React.Component { } private handleGlobalKeyDown(e: globalThis.KeyboardEvent): void { - const { visible } = this.props; + const { visible, treeNodeSelection } = this.props; if (visible) { if (e.key === "ArrowUp") { this.markSuggestionAsHoveredAndMakeVisible(Math.max(0, this._currentlySelectedSuggestionIndex - 1)); @@ -153,7 +158,7 @@ export class Suggestions extends React.Component { Math.min(this._allOptions.length - 1, this._currentlySelectedSuggestionIndex + 1) ); } - if (e.key == "Enter" && this.currentlySelectedSuggestion() !== undefined) { + if (e.key == "Enter" && this.currentlySelectedSuggestion() !== undefined && this._allOptions.length > 0 && !treeNodeSelection?.focussedNodeNameContainsWildcard()) { this.useSuggestion(e, this.currentlySelectedSuggestion().getAttribute("data-use") as string); } } diff --git a/frontend/src/lib/components/SmartNodeSelector/smartNodeSelector.tsx b/frontend/src/lib/components/SmartNodeSelector/smartNodeSelector.tsx index 237f6de8f..85c7111ac 100644 --- a/frontend/src/lib/components/SmartNodeSelector/smartNodeSelector.tsx +++ b/frontend/src/lib/components/SmartNodeSelector/smartNodeSelector.tsx @@ -236,10 +236,6 @@ export class SmartNodeSelectorComponent extends React.Component).current as HTMLUListElement; const suggestions = (this.suggestionsRef as React.RefObject).current as HTMLDivElement; const eventTarget = event.target as Element; + if (domNode && domNode.getBoundingClientRect().width === 0) { + return; + } if ((!domNode || !domNode.contains(eventTarget)) && (!suggestions || !suggestions.contains(eventTarget))) { + this.noUserInputSelect = false; this.hideSuggestions({ callback: () => { if (!this.selectionHasStarted) { this.unselectAllTags({}); - this.updateState({ currentTagIndex: -1 }); } this.selectionHasStarted = false; diff --git a/frontend/src/lib/components/VectorSelector/vectorSelector.tsx b/frontend/src/lib/components/VectorSelector/vectorSelector.tsx index 140b77b8c..71c3b69e7 100644 --- a/frontend/src/lib/components/VectorSelector/vectorSelector.tsx +++ b/frontend/src/lib/components/VectorSelector/vectorSelector.tsx @@ -88,11 +88,6 @@ export class VectorSelectorComponent extends SmartNodeSelectorComponent { } componentDidUpdate(prevProps: VectorSelectorProps): void { - if (this.updateFromWithin) { - this.updateFromWithin = false; - return; - } - if ( this.props.customVectorDefinitions && JSON.stringify(this.props.customVectorDefinitions) !== JSON.stringify(prevProps.customVectorDefinitions)