diff --git a/src/relations/Bounds.js b/src/relations/Bounds.js index 3ebae4b..9f09d9a 100644 --- a/src/relations/Bounds.js +++ b/src/relations/Bounds.js @@ -93,13 +93,14 @@ const mergeBounds = clientBounds => { }; const extend = function(a, b) { + const { bottom, height, top } = a; + const x = Math.min(a.x, b.x); const left = Math.min(a.left, b.left); const y = Math.max(a.y, b.y); const right = Math.max(a.right, b.right); const width = a.width + b.width; - const { bottom, height, top } = a; return { bottom, height, left, right, top, width, x, y }; }; diff --git a/src/relations/editor/RelationAutocomplete.js b/src/relations/editor/RelationAutocomplete.js index 5165037..30ecc84 100644 --- a/src/relations/editor/RelationAutocomplete.js +++ b/src/relations/editor/RelationAutocomplete.js @@ -26,11 +26,17 @@ const RelationAutocomplete = props => { getItemProps, } = useCombobox({ items: inputItems, onInputValueChange }); + const onKeyDown = evt => { + // Only forward key events if the dropdown is closed, or no option selected) + if (!isOpen || highlightedIndex == -1) + props.onKeyDown(evt); + } + return (
{ if (!isOpen) props.onKeyDown(evt); } })} + {...getInputProps({ onKeyDown })} placeholder={props.placeholder} value={props.content} />
diff --git a/themes/default/relations/_editor.scss b/themes/default/relations/_editor.scss index 68114ce..7178ecb 100644 --- a/themes/default/relations/_editor.scss +++ b/themes/default/relations/_editor.scss @@ -57,6 +57,10 @@ box-shadow:0 0 20px rgba(0,0,0,0.25); } + ul:empty { + display:none; + } + li { box-sizing:border-box; padding:2px 12px;