File tree 2 files changed +16
-1
lines changed
packages/twenty-front/src/modules/ui/layout/dropdown/components
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 4
4
FloatingPortal ,
5
5
offset ,
6
6
Placement ,
7
+ size ,
7
8
useFloating ,
8
9
} from '@floating-ui/react' ;
9
10
import { MouseEvent , useEffect , useRef } from 'react' ;
@@ -85,7 +86,19 @@ export const Dropdown = ({
85
86
86
87
const { refs, floatingStyles, placement } = useFloating ( {
87
88
placement : dropdownPlacement ,
88
- middleware : [ flip ( ) , ...offsetMiddlewares ] ,
89
+ middleware : [
90
+ flip ( ) ,
91
+ size ( {
92
+ padding : 12 + 20 , // 12px for padding bottom, 20px for dropdown bottom margin target
93
+ apply : ( { availableHeight, elements } ) => {
94
+ elements . floating . style . maxHeight =
95
+ availableHeight >= elements . floating . scrollHeight
96
+ ? ''
97
+ : `${ availableHeight } px` ;
98
+ } ,
99
+ } ) ,
100
+ ...offsetMiddlewares ,
101
+ ] ,
89
102
whileElementsMounted : autoUpdate ,
90
103
strategy : dropdownStrategy ,
91
104
} ) ;
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ const StyledDropdownMenu = styled.div<{
25
25
26
26
flex-direction: column;
27
27
z-index: 30;
28
+ overflow-y: auto;
29
+ overflow-x: hidden;
28
30
width: ${ ( { width = 160 } ) =>
29
31
typeof width === 'number' ? `${ width } px` : width } ;
30
32
` ;
You can’t perform that action at this time.
0 commit comments