Skip to content

Commit f2847f5

Browse files
committed
Fix weird scroll issues
1 parent 833b8eb commit f2847f5

File tree

3 files changed

+60
-61
lines changed

3 files changed

+60
-61
lines changed

src/components/dashboard/user_management/EditableSubscriptionsCell.tsx

Lines changed: 57 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
PopoverBody,
88
PopoverContent,
99
PopoverTrigger,
10-
Portal,
1110
Tag,
1211
TagLabel,
1312
Text,
@@ -316,64 +315,63 @@ const EditableSubscriptionsCell: React.FC<EditableSubscriptionsCellProps> = ({
316315
</Box>
317316
</PopoverTrigger>
318317

319-
<Portal>
320-
<PopoverContent
321-
width={
322-
triggerRef.current?.offsetWidth
323-
? `${triggerRef.current.offsetWidth}px`
324-
: '100%'
325-
}
326-
borderColor="neutralGray.300"
327-
ref={popoverRef}
328-
zIndex={1}
329-
mt="2px"
330-
>
331-
<PopoverBody p={0} maxHeight="300px" overflowY="auto" zIndex={1}>
332-
{sortedSubjects.map((subject) => {
333-
const isSelected = selectedSubjectIds.includes(subject.id);
334-
const bgColor = subject.colorGroup.colorCodes[1];
335-
const borderColor = subject.colorGroup.colorCodes[1];
336-
337-
return (
338-
<Box
339-
key={subject.id}
340-
p={2.5}
341-
pl={4}
342-
display="flex"
343-
alignItems="center"
344-
_hover={{ bg: 'neutralGray.100' }}
345-
onClick={(e) => handleSubjectChange(subject.id, e)}
346-
cursor="pointer"
347-
>
348-
<Checkbox
349-
isChecked={isSelected}
350-
onChange={(e) => {
351-
e.nativeEvent.stopPropagation();
352-
handleSubjectChange(subject.id);
353-
}}
354-
mr={2}
355-
_checked={{
356-
'& .chakra-checkbox__control': {
357-
bg: bgColor,
358-
borderColor: borderColor,
359-
},
360-
}}
361-
_hover={{
362-
'& .chakra-checkbox__control': {
363-
borderColor: borderColor,
364-
bg: bgColor,
365-
opacity: 0.7,
366-
},
367-
}}
368-
borderColor={borderColor}
369-
/>
370-
<Text textStyle="label">{subject.name}</Text>
371-
</Box>
372-
);
373-
})}
374-
</PopoverBody>
375-
</PopoverContent>
376-
</Portal>
318+
<PopoverContent
319+
width={
320+
triggerRef.current?.offsetWidth
321+
? `${triggerRef.current.offsetWidth}px`
322+
: '100%'
323+
}
324+
maxWidth="80vw"
325+
borderColor="neutralGray.300"
326+
ref={popoverRef}
327+
zIndex={1}
328+
mt="2px"
329+
>
330+
<PopoverBody p={0} maxHeight="300px" overflowY="auto" zIndex={1}>
331+
{sortedSubjects.map((subject) => {
332+
const isSelected = selectedSubjectIds.includes(subject.id);
333+
const bgColor = subject.colorGroup.colorCodes[1];
334+
const borderColor = subject.colorGroup.colorCodes[1];
335+
336+
return (
337+
<Box
338+
key={subject.id}
339+
p={2.5}
340+
pl={4}
341+
display="flex"
342+
alignItems="center"
343+
_hover={{ bg: 'neutralGray.100' }}
344+
onClick={(e) => handleSubjectChange(subject.id, e)}
345+
cursor="pointer"
346+
>
347+
<Checkbox
348+
isChecked={isSelected}
349+
onChange={(e) => {
350+
e.nativeEvent.stopPropagation();
351+
handleSubjectChange(subject.id);
352+
}}
353+
mr={2}
354+
_checked={{
355+
'& .chakra-checkbox__control': {
356+
bg: bgColor,
357+
borderColor: borderColor,
358+
},
359+
}}
360+
_hover={{
361+
'& .chakra-checkbox__control': {
362+
borderColor: borderColor,
363+
bg: bgColor,
364+
opacity: 0.7,
365+
},
366+
}}
367+
borderColor={borderColor}
368+
/>
369+
<Text textStyle="label">{subject.name}</Text>
370+
</Box>
371+
);
372+
})}
373+
</PopoverBody>
374+
</PopoverContent>
377375
</Popover>
378376
</Box>
379377
);

src/components/dashboard/user_management/FilterPopup.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export const FilterPopup: React.FC<FilterPopupProps> = ({
168168
boxShadow="md"
169169
border="1px solid"
170170
borderColor="neutralGray.300"
171+
zIndex={5000}
171172
>
172173
<Flex justifyContent="space-between" alignItems="center" mb={5}>
173174
<Text textStyle="h3">Filter Options</Text>

src/components/dashboard/user_management/UserManagementTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ export const UserManagementTable: React.FC<UserManagementTableProps> = ({
242242
borderColor="neutralGray.300"
243243
height="100%"
244244
>
245-
<HStack justify="space-between" mx={5} my={3}>
245+
<HStack justify="space-between" mx={5} my={3} zIndex={5000}>
246246
<Text textStyle="h2" fontSize="18px" fontWeight={700} lineHeight="33px">
247247
User Management
248248
</Text>
@@ -286,7 +286,7 @@ export const UserManagementTable: React.FC<UserManagementTableProps> = ({
286286
<Thead
287287
position="sticky"
288288
top={0}
289-
zIndex={1000} // Make sure it's above the popover for editing email subscriptions
289+
zIndex={3000} // Make sure it's above the popover for editing email subscriptions but below the filter popup
290290
bg="white"
291291
boxShadow="0 1px 1px rgba(227, 227, 227, 1)"
292292
>

0 commit comments

Comments
 (0)