Skip to content

Commit cd69526

Browse files
YashK2005UmairHundekar
authored andcommitted
Fix dropdown styling (#70)
Small fix for dropdown styling where some dropdowns in the intake form were being covered. Before <img width="421" height="341" alt="image" src="https://github.com/user-attachments/assets/85a5dc4f-0e0f-4df6-a061-cb7ed202eb50" /> After <img width="472" height="475" alt="Screenshot 2025-11-10 at 7 41 39 PM" src="https://github.com/user-attachments/assets/8e7f3e67-eda9-4a06-8f7b-b0db418cf8a0" /> ## Notion ticket link <!-- Please replace with your ticket's URL --> [Ticket Name](https://www.notion.so/uwblueprintexecs/Task-Board-db95cd7b93f245f78ee85e3a8a6a316d) <!-- Give a quick summary of the implementation details, provide design justifications if necessary --> ## Implementation description * <!-- What should the reviewer do to verify your changes? Describe expected results and include screenshots when appropriate --> ## Steps to test 1. <!-- Draw attention to the substantial parts of your PR or anything you'd like a second opinion on --> ## What should reviewers focus on? * ## Checklist - [ ] My PR name is descriptive and in imperative tense - [ ] My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits - [ ] I have run the appropriate linter(s) - [ ] I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR
1 parent bdde7fa commit cd69526

File tree

5 files changed

+51
-11
lines changed

5 files changed

+51
-11
lines changed

frontend/src/components/intake/personal-info-form.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ interface PersonalInfoFormData {
2626
interface PersonalInfoFormProps {
2727
formType: 'participant' | 'volunteer';
2828
onSubmit: (experienceData: ExperienceData, personalData: PersonalData) => void;
29+
onDropdownOpenChange?: (isOpen: boolean) => void;
2930
}
3031

31-
export function PersonalInfoForm({ formType, onSubmit }: PersonalInfoFormProps) {
32+
export function PersonalInfoForm({
33+
formType,
34+
onSubmit,
35+
onDropdownOpenChange,
36+
}: PersonalInfoFormProps) {
3237
const router = useRouter();
3338
const {
3439
control,
@@ -321,6 +326,7 @@ export function PersonalInfoForm({ formType, onSubmit }: PersonalInfoFormProps)
321326
onSelectionChange={field.onChange}
322327
placeholder="Province"
323328
error={!!errors.province}
329+
onOpenChange={onDropdownOpenChange}
324330
/>
325331
)}
326332
/>

frontend/src/components/ui/multi-select-dropdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const MultiSelectDropdown: React.FC<MultiSelectDropdownProps> = ({
5151
};
5252

5353
return (
54-
<Box position="relative" w="full" ref={dropdownRef} zIndex={1}>
54+
<Box position="relative" w="full" ref={dropdownRef}>
5555
<button
5656
type="button"
5757
onClick={() => setIsOpen(!isOpen)}
@@ -149,7 +149,7 @@ export const MultiSelectDropdown: React.FC<MultiSelectDropdownProps> = ({
149149
border="1px solid #d1d5db"
150150
borderRadius="6px"
151151
boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"
152-
zIndex={1000}
152+
zIndex={9999}
153153
>
154154
{options.map((option) => {
155155
const isSelected = selectedValues.includes(option);

frontend/src/components/ui/single-select-dropdown.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ interface SingleSelectDropdownProps {
88
onSelectionChange: (value: string) => void;
99
placeholder: string;
1010
error?: boolean;
11+
onOpenChange?: (isOpen: boolean) => void;
1112
}
1213

1314
export const SingleSelectDropdown: React.FC<SingleSelectDropdownProps> = ({
@@ -16,15 +17,23 @@ export const SingleSelectDropdown: React.FC<SingleSelectDropdownProps> = ({
1617
onSelectionChange,
1718
placeholder,
1819
error,
20+
onOpenChange,
1921
}) => {
2022
const [isOpen, setIsOpen] = useState(false);
2123
const dropdownRef = useRef<HTMLDivElement>(null);
2224

25+
const handleToggle = () => {
26+
const newIsOpen = !isOpen;
27+
setIsOpen(newIsOpen);
28+
onOpenChange?.(newIsOpen);
29+
};
30+
2331
// Close dropdown when clicking outside
2432
useEffect(() => {
2533
const handleClickOutside = (event: MouseEvent) => {
2634
if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
2735
setIsOpen(false);
36+
onOpenChange?.(false);
2837
}
2938
};
3039

@@ -35,11 +44,12 @@ export const SingleSelectDropdown: React.FC<SingleSelectDropdownProps> = ({
3544
return () => {
3645
document.removeEventListener('mousedown', handleClickOutside);
3746
};
38-
}, [isOpen]);
47+
}, [isOpen, onOpenChange]);
3948

4049
const handleSelect = (option: string) => {
4150
onSelectionChange(option);
4251
setIsOpen(false);
52+
onOpenChange?.(false);
4353
};
4454

4555
const handleRemove = (e: React.MouseEvent) => {
@@ -48,10 +58,10 @@ export const SingleSelectDropdown: React.FC<SingleSelectDropdownProps> = ({
4858
};
4959

5060
return (
51-
<Box position="relative" w="full" ref={dropdownRef} zIndex={1}>
61+
<Box position="relative" w="full" ref={dropdownRef}>
5262
<button
5363
type="button"
54-
onClick={() => setIsOpen(!isOpen)}
64+
onClick={handleToggle}
5565
style={{
5666
width: '100%',
5767
minHeight: '40px',
@@ -143,7 +153,7 @@ export const SingleSelectDropdown: React.FC<SingleSelectDropdownProps> = ({
143153
border="1px solid #d1d5db"
144154
borderRadius="6px"
145155
boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"
146-
zIndex={1000}
156+
zIndex={9999}
147157
>
148158
{options.map((option) => (
149159
<Box

frontend/src/pages/participant/intake/index.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export default function ParticipantIntakePage() {
6666
formType: 'participant',
6767
});
6868
const [, setSubmitting] = useState(false);
69+
const [hasDropdownOpen, setHasDropdownOpen] = useState(false);
6970

7071
const computeFlowSteps = (data: IntakeFormData) => {
7172
const { hasBloodCancer, caringForSomeone } = data;
@@ -226,7 +227,14 @@ export default function ParticipantIntakePage() {
226227
return (
227228
<ProtectedPage allowedRoles={[UserRole.PARTICIPANT, UserRole.ADMIN]}>
228229
<FormStatusGuard allowedStatuses={[FormStatus.INTAKE_TODO]}>
229-
<Flex minH="100vh" bg={COLORS.lightGray} justify="center" py={12} overflow="visible">
230+
<Flex
231+
minH="100vh"
232+
bg={COLORS.lightGray}
233+
justify="center"
234+
py={12}
235+
overflow="visible"
236+
pb={hasDropdownOpen ? '50vh' : 12}
237+
>
230238
<Box
231239
w="full"
232240
maxW="1200px"
@@ -238,7 +246,11 @@ export default function ParticipantIntakePage() {
238246
position="relative"
239247
>
240248
{currentStepType === 'experience-personal' && (
241-
<PersonalInfoForm formType="participant" onSubmit={handleExperiencePersonalSubmit} />
249+
<PersonalInfoForm
250+
formType="participant"
251+
onSubmit={handleExperiencePersonalSubmit}
252+
onDropdownOpenChange={setHasDropdownOpen}
253+
/>
242254
)}
243255

244256
{currentStepType === 'demographics-cancer' && (

frontend/src/pages/volunteer/intake/index.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export default function VolunteerIntakePage() {
6666
formType: 'volunteer',
6767
});
6868
const [, setSubmitting] = useState(false);
69+
const [hasDropdownOpen, setHasDropdownOpen] = useState(false);
6970

7071
// Determine flow based on experience type selections
7172
const computeFlowSteps = (data: IntakeFormData) => {
@@ -235,7 +236,14 @@ export default function VolunteerIntakePage() {
235236
return (
236237
<ProtectedPage allowedRoles={[UserRole.VOLUNTEER, UserRole.ADMIN]}>
237238
<FormStatusGuard allowedStatuses={[FormStatus.INTAKE_TODO]}>
238-
<Flex minH="100vh" bg={COLORS.lightGray} justify="center" py={12} overflow="visible">
239+
<Flex
240+
minH="100vh"
241+
bg={COLORS.lightGray}
242+
justify="center"
243+
py={12}
244+
overflow="visible"
245+
pb={hasDropdownOpen ? '30vh' : 12}
246+
>
239247
<Box
240248
w="full"
241249
maxW="1200px"
@@ -247,7 +255,11 @@ export default function VolunteerIntakePage() {
247255
position="relative"
248256
>
249257
{currentStepType === 'experience-personal' && (
250-
<PersonalInfoForm formType="volunteer" onSubmit={handleExperiencePersonalSubmit} />
258+
<PersonalInfoForm
259+
formType="volunteer"
260+
onSubmit={handleExperiencePersonalSubmit}
261+
onDropdownOpenChange={setHasDropdownOpen}
262+
/>
251263
)}
252264

253265
{currentStepType === 'demographics-cancer' && (

0 commit comments

Comments
 (0)