Skip to content

Commit

Permalink
fix: manage margin bottom on AutoCompleteSearch when list is empty (#824
Browse files Browse the repository at this point in the history
)

* RM#87262
  • Loading branch information
lme-axelor committed Dec 5, 2024
1 parent 9545661 commit 0044c57
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelogs/unreleased/87262.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"title": "AutoCompleteSearch: manage margin bottom when the list is empty",
"type": "fix",
"packages": "ui"
}
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,12 @@ const AutoCompleteSearch = ({

const marginBottom = useMemo(() => {
if (isScrollViewContainer && displayList) {
return 5 * ITEM_HEIGHT + 5;
const visibleListLength = Math.max(
!Array.isArray(objectList) ? 0 : Math.min(objectList.length, 5),
1,
);

return visibleListLength * ITEM_HEIGHT + 5;
}

return null;
Expand Down

0 comments on commit 0044c57

Please sign in to comment.