Fixes Strange behaviour when reordering options of select field (#6103) (#6339)

fixes #6103

---------

Co-authored-by: Marie Stoppa <marie.stoppa@essec.edu>
This commit is contained in:
Faisal-imtiyaz123
2024-07-22 18:03:02 +05:30
committed by GitHub
parent f24536c115
commit 284e75791c
2 changed files with 4 additions and 1 deletions

View File

@ -218,6 +218,7 @@ export const SettingsDataModelFieldSelectForm = ({
<>
{options.map((option, index) => (
<DraggableItem
isInsideScrollableContainer
key={option.id}
draggableId={option.id}
index={index}

View File

@ -7,6 +7,7 @@ type DraggableItemProps = {
isDragDisabled?: boolean;
index: number;
itemComponent: JSX.Element;
isInsideScrollableContainer?: boolean;
};
export const DraggableItem = ({
@ -14,6 +15,7 @@ export const DraggableItem = ({
isDragDisabled = false,
index,
itemComponent,
isInsideScrollableContainer,
}: DraggableItemProps) => {
const theme = useTheme();
return (
@ -36,7 +38,7 @@ export const DraggableItem = ({
style={{
...draggableStyle,
left: 'auto',
top: 'auto',
...(isInsideScrollableContainer ? {} : { top: 'auto' }),
transform: draggableStyle?.transform?.replace(
/\(-?\d+px,/,
'(0,',