diff --git a/packages/grafana-ui/src/components/Combobox/Combobox.tsx b/packages/grafana-ui/src/components/Combobox/Combobox.tsx index 23b9402e226..eb8112ba6be 100644 --- a/packages/grafana-ui/src/components/Combobox/Combobox.tsx +++ b/packages/grafana-ui/src/components/Combobox/Combobox.tsx @@ -375,55 +375,57 @@ export const Combobox = (props: ComboboxProps) => 'aria-labelledby': ariaLabelledBy, })} > - - {isOpen && !asyncError && ( -
    - {rowVirtualizer.getVirtualItems().map((virtualRow) => { - return ( -
  • -
    - - {items[virtualRow.index].label ?? items[virtualRow.index].value} - - {items[virtualRow.index].description && ( - {items[virtualRow.index].description} + {isOpen && ( + + {!asyncError && ( +
      + {rowVirtualizer.getVirtualItems().map((virtualRow) => { + return ( +
    • -
    • - ); - })} -
    - )} -
    - {asyncError && ( - - - An error occurred while loading options. - + style={{ + height: virtualRow.size, + transform: `translateY(${virtualRow.start}px)`, + }} + {...getItemProps({ + item: items[virtualRow.index], + index: virtualRow.index, + })} + > +
    + + {items[virtualRow.index].label ?? items[virtualRow.index].value} + + {items[virtualRow.index].description && ( + {items[virtualRow.index].description} + )} +
    +
  • + ); + })} +
)} - {items.length === 0 && !asyncError && ( - - No options found. - - )} - -
+
+ {asyncError && ( + + + An error occurred while loading options. + + )} + {items.length === 0 && !asyncError && ( + + No options found. + + )} +
+ + )} );