Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(ui): restore wheel scrolling in select menus rendered inside dialogs (#7819)

claude[bot]90505e9aaad9
diff --git a/frontend/src/components/v3/generic/ReactSelect/CreatableSelect.tsx b/frontend/src/components/v3/generic/ReactSelect/CreatableSelect.tsx
index 426617fcf1..f62626e037 100644
--- a/frontend/src/components/v3/generic/ReactSelect/CreatableSelect.tsx
+++ b/frontend/src/components/v3/generic/ReactSelect/CreatableSelect.tsx
@@ -1,7 +1,13 @@
import { GroupBase } from "react-select";
import ReactSelectCreatable, { CreatableProps } from "react-select/creatable";
-import { ClearIndicator, DropdownIndicator, MultiValueRemove, Option } from "./components";
+import {
+ ClearIndicator,
+ DropdownIndicator,
+ MenuList,
+ MultiValueRemove,
+ Option
+} from "./components";
import { getSelectClassNames, selectClassNames, selectStyles } from "./styles";
export const CreatableSelect = <T,>({
@@ -23,7 +29,14 @@ export const CreatableSelect = <T,>({
menuPortalTarget={menuPortalTarget}
menuPosition={menuPosition}
styles={selectStyles as any}
- components={{ DropdownIndicator, ClearIndicator, MultiValueRemove, Option, ...components }}
+ components={{
+ DropdownIndicator,
+ ClearIndicator,
+ MenuList,
+ MultiValueRemove,
+ Option,
+ ...components
+ }}
classNames={(isError ? getSelectClassNames(isError) : selectClassNames) as any}
{...props}
/>
diff --git a/frontend/src/components/v3/generic/ReactSelect/FilterableSelect.tsx b/frontend/src/components/v3/generic/ReactSelect/FilterableSelect.tsx
index ecdfd7f511..49ea42e895 100644
--- a/frontend/src/components/v3/generic/ReactSelect/FilterableSelect.tsx
+++ b/frontend/src/components/v3/generic/ReactSelect/FilterableSelect.tsx
@@ -1,6 +1,13 @@
import Select, { GroupBase, Props } from "react-select";
-import { ClearIndicator, DropdownIndicator, Group, MultiValueRemove, Option } from "./components";
+import {
+ ClearIndicator,
+ DropdownIndicator,
+ Group,
+ MenuList,
+ MultiValueRemove,
+ Option
+} from "./components";
import { getSelectClassNames, selectClassNames, selectStyles } from "./styles";
/**
@@ -62,6 +69,7 @@ export const FilterableSelect = <T,>({
components={{
DropdownIndicator,
ClearIndicator,
+ MenuList,
MultiValueRemove,
Option,
Group,
diff --git a/frontend/src/components/v3/generic/ReactSelect/components.tsx b/frontend/src/components/v3/generic/ReactSelect/components.tsx
index ef7b529861..40d5d35185 100644
--- a/frontend/src/components/v3/generic/ReactSelect/components.tsx
+++ b/frontend/src/components/v3/generic/ReactSelect/components.tsx
@@ -3,6 +3,7 @@ import {
components,
DropdownIndicatorProps,
GroupProps,
+ MenuListProps,
MultiValueRemoveProps,
OptionProps
} from "react-select";
@@ -41,3 +42,10 @@ export const Option = <T,>({ isSelected, children, ...props }: OptionProps<T>) =
export const Group = <T,>(props: GroupProps<T>) => {
return <components.Group {...props} />;
};
+
+export const MenuList = <T,>({ innerProps, ...props }: MenuListProps<T>) => (
+ <components.MenuList
+ {...props}
+ innerProps={{ ...innerProps, onWheel: (event) => event.stopPropagation() }}
+ />
+);
diff --git a/frontend/src/components/v3/generic/ReactSelect/styles.ts b/frontend/src/components/v3/generic/ReactSelect/styles.ts
index 60967f7e6b..663436a194 100644
--- a/frontend/src/components/v3/generic/ReactSelect/styles.ts
+++ b/frontend/src/components/v3/generic/ReactSelect/styles.ts
@@ -20,7 +20,7 @@ export const selectClassNames: ClassNamesConfig<unknown, boolean, GroupBase<unkn
multiValueRemove: () =>
"shrink-0 [&>svg]:size-3 [&>svg]:shrink-0 hover:text-danger text-muted cursor-pointer ml-0.5",
menu: () => "my-2 w-full rounded-[6px] border border-border bg-popover p-1 shadow-md",
- menuList: () => "max-h-48 text-sm overflow-y-auto thin-scrollbar",
+ menuList: () => "max-h-48 text-sm overflow-y-auto overscroll-contain thin-scrollbar",
option: ({ isFocused }) =>
cn(
"cursor-pointer rounded-sm truncate px-2 py-1.5 text-sm text-foreground",
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/AssignAccessModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AssignAccessModal.tsx
index d23bf0465d..746f8589f9 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/AssignAccessModal.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/AssignAccessModal.tsx
@@ -1,10 +1,10 @@
import { useMemo, useState } from "react";
-import { components, OptionProps } from "react-select";
-import { BotIcon, CheckIcon, User as UserIcon, Users as UsersIcon } from "lucide-react";
+import { BotIcon, User as UserIcon, Users as UsersIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import {
Button,
+ Combobox,
Dialog,
DialogContent,
DialogFooter,
@@ -13,7 +13,6 @@ import {
Field,
FieldContent,
FieldLabel,
- FilterableSelect,
Select,
SelectContent,
SelectItem,
@@ -23,7 +22,6 @@ import {
import { useOrganization } from "@app/context";
import { useGetOrganizationGroups } from "@app/hooks/api/organization/queries";
import {
- TPamResourceRole,
useAddAccountGroupMember,
useAddAccountIdentityMember,
useAddAccountMember,
@@ -77,37 +75,6 @@ const ASSIGNEE_ICON: Record<PamMemberKind, typeof UserIcon> = {
[PamMemberKind.Identity]: BotIcon
};
-const AssigneeSelectOption = ({ children, ...props }: OptionProps<AssigneeOption>) => {
- const Icon = ASSIGNEE_ICON[props.data.kind];
- return (
- <components.Option {...props}>
- <div className="flex items-center gap-2.5">
- <Icon className="size-4 shrink-0 text-muted" />
- <div className="min-w-0">
- <p className="truncate">{children}</p>
- {props.data.subtitle && (
- <p className="truncate text-xs leading-4 text-muted">{props.data.subtitle}</p>
- )}
- </div>
- </div>
- </components.Option>
- );
-};
-
-const ResourceRoleOption = ({ isSelected, children, ...props }: OptionProps<TPamResourceRole>) => (
- <components.Option isSelected={isSelected} {...props}>
- <div className="flex items-start justify-between gap-2 whitespace-normal">
- <div className="min-w-0">
- <p>{children}</p>
- {props.data.description && (
- <p className="text-xs leading-4 text-muted">{props.data.description}</p>
- )}
- </div>
- {isSelected && <CheckIcon className="mt-0.5 size-4 shrink-0" />}
- </div>
- </components.Option>
-);
-
type Props = {
isOpen: boolean;
onOpenChange: (open: boolean) => void;
@@ -390,33 +357,67 @@ export const AssignAccessModal = ({
<div className="flex flex-col gap-4">
<Field>
- <FieldLabel>Assignee</FieldLabel>
+ <FieldLabel htmlFor="pam-assign-access-assignee">Assignee</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
+ id="pam-assign-access-assignee"
value={isEdit ? lockedActor : selectedActor}
options={assigneeOptions}
isDisabled={isEdit}
- onChange={(opt) => setSelectedActor((opt as AssigneeOption | null) ?? null)}
+ onValueChange={(opt) => setSelectedActor(opt)}
getOptionValue={(opt) => `${opt.kind}:${opt.value}`}
getOptionLabel={(opt) => opt.label}
- components={{ Option: AssigneeSelectOption }}
+ getOptionKeywords={(opt) => (opt.subtitle ? [opt.subtitle] : [])}
placeholder="Pick a user, group, or identity..."
- noOptionsMessage={() => "No users, groups, or identities available to assign."}
+ searchPlaceholder="Pick a user, group, or identity..."
+ searchAriaLabel="Search users, groups, and identities"
+ emptyMessage="No users, groups, or identities available to assign."
+ modal
+ renderOption={(opt) => {
+ const Icon = ASSIGNEE_ICON[opt.kind];
+ return (
+ <span className="flex min-w-0 items-center gap-2.5">
+ <Icon className="size-4 shrink-0 text-muted" />
+ <span className="min-w-0">
+ <span className="block truncate">{opt.label}</span>
+ {opt.subtitle && (
+ <span className="block truncate text-xs leading-4 text-muted">
+ {opt.subtitle}
+ </span>
+ )}
+ </span>
+ </span>
+ );
+ }}
/>
</FieldContent>
</Field>
<Field>
- <FieldLabel>Role</FieldLabel>
+ <FieldLabel htmlFor="pam-assign-access-role">Role</FieldLabel>
<FieldContent>
- <FilterableSelect
+ <Combobox
+ id="pam-assign-access-role"
value={selectedRole}
options={resourceRoles ?? []}
- onChange={(opt) => setRoleSlug((opt as TPamResourceRole | null)?.slug ?? "")}
+ onValueChange={(opt) => setRoleSlug(opt.slug)}
getOptionValue={(opt) => opt.slug}
getOptionLabel={(opt) => opt.name}
- components={{ Option: ResourceRoleOption }}
placeholder="Select a role..."
+ searchPlaceholder="Select a role..."
+ searchAriaLabel="Search roles"
+ emptyMessage="No roles found."
+ modal
+ renderOption={(opt) => (
+ <span className="block min-w-0">
+ <span className="block">{opt.name}</span>
+ {opt.description && (
+ <span className="block text-xs leading-4 whitespace-normal text-muted">
+ {opt.description}
+ </span>
+ )}
+ </span>
+ )}
/>
</FieldContent>
</Field>