AutoComplete: Select node onBlur #59
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From Issue #58:
The Problem
The AutoComplete field is designed to support a variety of input methods, including selecting by clicking on the graph and typing a partial name, viewing suggestions, and selecting a suggestion. This generally works well when it's used in the Search field or the NodeSelector form.
When editing an edge, the AutoComplete field is also used to set the Source (and more commonly) the Target nodes. This generally works well when the user either clicks on a node on the graph to select it, or when using type-ahead to select a node -- they type a partial node name, then they click on the full name in the suggestion. This works because clicking on a suggested node triggers a SOURCE_SELECT event, where we can verify that the selected node is a valid node.
The problem occurs when the user types in the full name of the node and then hits Tab to go on to the next field. In this case, no event is triggered, so we never verify that the node name typed in is a valid node, and therefore we don't re-enable the "Save" button.
To replicate:
The Solution
We use the onBlur event on the AutoComplete field to trigger a review of the current field value. If the value in the AutoComplete field is an exact match with a node label, select the label.
To Test
A few more points:
This has the side effect of also allowing selection of a node via the Search field: