From f81dbbcc64e4ee136b2e8da2acab59c14bc2b88d Mon Sep 17 00:00:00 2001 From: Et7f3 Date: Tue, 15 Oct 2024 15:39:22 +0200 Subject: [PATCH 1/2] MultiSelect: Allow to be inline on first render. fix #7341 --- components/lib/multiselect/MultiSelect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lib/multiselect/MultiSelect.js b/components/lib/multiselect/MultiSelect.js index 02bd215b86..ae0be84fa1 100644 --- a/components/lib/multiselect/MultiSelect.js +++ b/components/lib/multiselect/MultiSelect.js @@ -519,7 +519,7 @@ export const MultiSelect = React.memo( }; const alignOverlay = () => { - DomHandler.alignOverlay(overlayRef.current, labelContainerRef.current.parentElement, props.appendTo || (context && context.appendTo) || PrimeReact.appendTo); + labelContainerRef.current && DomHandler.alignOverlay(overlayRef.current, labelContainerRef.current.parentElement, props.appendTo || (context && context.appendTo) || PrimeReact.appendTo); }; const isClearClicked = (event) => { From f233c64ee0f885f23d9df0c624b8dfed872ee642 Mon Sep 17 00:00:00 2001 From: Et7f3 Date: Wed, 16 Oct 2024 11:35:29 +0200 Subject: [PATCH 2/2] MultiSelect: don't align when inline. Their is no parent when we are inline so overlayRef is empty. Co-authored-by: Melloware --- components/lib/multiselect/MultiSelect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lib/multiselect/MultiSelect.js b/components/lib/multiselect/MultiSelect.js index ae0be84fa1..20f3af5ebf 100644 --- a/components/lib/multiselect/MultiSelect.js +++ b/components/lib/multiselect/MultiSelect.js @@ -519,7 +519,7 @@ export const MultiSelect = React.memo( }; const alignOverlay = () => { - labelContainerRef.current && DomHandler.alignOverlay(overlayRef.current, labelContainerRef.current.parentElement, props.appendTo || (context && context.appendTo) || PrimeReact.appendTo); + !props.inline && DomHandler.alignOverlay(overlayRef.current, labelContainerRef.current.parentElement, props.appendTo || (context && context.appendTo) || PrimeReact.appendTo); }; const isClearClicked = (event) => {