fix: dropdown with the height of the sticky div (#605)

This commit is contained in:
LangLangBart 2023-11-07 00:03:05 +01:00 • committed by GitHub
parent 910c68ba77
commit a8d6ff04e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -707,6 +707,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
}, [inputRef.current, props.isMainInput, persistSession]);
const deleteButtonDivRef = React.useRef<HTMLDivElement>(null);
const stickyDropdownHeaderDiv = React.useRef<HTMLDivElement>(null);
const selectContextItemFromDropdown = useCallback(
(event: any) => {
@ -1408,6 +1409,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
>
{nestedContextProvider && (
<div
ref={stickyDropdownHeaderDiv}
style={{
backgroundColor: secondaryDark,
borderBottom: `0.5px solid ${lightGray}`,
@ -1431,7 +1433,15 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
{nestedContextProvider.description}
</div>
)}
<div style={{ maxHeight: `${UlMaxHeight - 50}px`, overflow: "auto" }}>
<div
style={{
maxHeight: `${
UlMaxHeight -
(stickyDropdownHeaderDiv.current?.clientHeight || 50)
}px`,
overflow: "auto",
}}
>
{downshiftProps.isOpen &&
items.map((item, index) => (
<Li