Behavior + style bugfixes

This commit is contained in:
Rainer Simon 2020-07-09 13:01:34 +02:00
parent 779629ed2f
commit e6e33158ab
3 changed files with 13 additions and 2 deletions

View File

@ -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 };
};

View File

@ -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 (
<div ref={element}>
<div {...getComboboxProps()}>
<input
{...getInputProps({ onKeyDown: evt => { if (!isOpen) props.onKeyDown(evt); } })}
{...getInputProps({ onKeyDown })}
placeholder={props.placeholder}
value={props.content} />
</div>

View File

@ -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;