Behavior + style bugfixes
This commit is contained in:
parent
779629ed2f
commit
e6e33158ab
|
@ -93,13 +93,14 @@ const mergeBounds = clientBounds => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const extend = function(a, b) {
|
const extend = function(a, b) {
|
||||||
|
const { bottom, height, top } = a;
|
||||||
|
|
||||||
const x = Math.min(a.x, b.x);
|
const x = Math.min(a.x, b.x);
|
||||||
const left = Math.min(a.left, b.left);
|
const left = Math.min(a.left, b.left);
|
||||||
const y = Math.max(a.y, b.y);
|
const y = Math.max(a.y, b.y);
|
||||||
const right = Math.max(a.right, b.right);
|
const right = Math.max(a.right, b.right);
|
||||||
const width = a.width + b.width;
|
const width = a.width + b.width;
|
||||||
|
|
||||||
const { bottom, height, top } = a;
|
|
||||||
return { bottom, height, left, right, top, width, x, y };
|
return { bottom, height, left, right, top, width, x, y };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,17 @@ const RelationAutocomplete = props => {
|
||||||
getItemProps,
|
getItemProps,
|
||||||
} = useCombobox({ items: inputItems, onInputValueChange });
|
} = 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 (
|
return (
|
||||||
<div ref={element}>
|
<div ref={element}>
|
||||||
<div {...getComboboxProps()}>
|
<div {...getComboboxProps()}>
|
||||||
<input
|
<input
|
||||||
{...getInputProps({ onKeyDown: evt => { if (!isOpen) props.onKeyDown(evt); } })}
|
{...getInputProps({ onKeyDown })}
|
||||||
placeholder={props.placeholder}
|
placeholder={props.placeholder}
|
||||||
value={props.content} />
|
value={props.content} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -57,6 +57,10 @@
|
||||||
box-shadow:0 0 20px rgba(0,0,0,0.25);
|
box-shadow:0 0 20px rgba(0,0,0,0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul:empty {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
li {
|
li {
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
padding:2px 12px;
|
padding:2px 12px;
|
||||||
|
|
Loading…
Reference in New Issue