Combobox: only render ScrollContainer when menu is open (#96271)

only render ScrollContainer when menu is open
This commit is contained in:
Ashley Harrison 2024-11-12 13:15:22 +00:00 committed by GitHub
parent 69a38c634c
commit 265342fbae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -375,8 +375,9 @@ export const Combobox = <T extends string | number>(props: ComboboxProps<T>) =>
'aria-labelledby': ariaLabelledBy,
})}
>
{isOpen && (
<ScrollContainer showScrollIndicators maxHeight="inherit" ref={scrollRef}>
{isOpen && !asyncError && (
{!asyncError && (
<ul style={{ height: rowVirtualizer.getTotalSize() }} className={styles.menuUlContainer}>
{rowVirtualizer.getVirtualItems().map((virtualRow) => {
return (
@ -424,6 +425,7 @@ export const Combobox = <T extends string | number>(props: ComboboxProps<T>) =>
)}
</div>
</ScrollContainer>
)}
</div>
</div>
);