Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(ui): correct tooltip behavior in select menus (#7594)
Andrew Huang327706515d30
diff --git a/frontend/src/components/v3/generic/ReactSelect/FilterableSelect.stories.tsx b/frontend/src/components/v3/generic/ReactSelect/FilterableSelect.stories.tsxindex ac23285ed6..98f8fb1cbc 100644--- a/frontend/src/components/v3/generic/ReactSelect/FilterableSelect.stories.tsx+++ b/frontend/src/components/v3/generic/ReactSelect/FilterableSelect.stories.tsx@@ -1,11 +1,15 @@import { useState } from "react";+import { components, OptionProps } from "react-select";import type { Meta, StoryObj } from "@storybook/react-vite";+import { InfoIcon } from "lucide-react";import { Field, FieldDescription, FieldError, FieldLabel } from "../Field";+import { Tooltip, TooltipContent, TooltipTrigger } from "../Tooltip";import { FilterableSelect } from "./FilterableSelect";type Option = { label: string; value: string };type RegionOption = Option & { region: string };+type PolicyOption = Option & { description: string };const ENVIRONMENT_OPTIONS: Option[] = [{ label: "Development", value: "dev" },@@ -25,6 +29,36 @@ const REGION_OPTIONS: RegionOption[] = [{ label: "ap-southeast-1 (Singapore)", value: "ap-southeast-1", region: "Asia Pacific" }];+const POLICY_OPTIONS: PolicyOption[] = [+ {+ label: "Secret Viewing Policies",+ value: "secret-viewer",+ description: "Grants read access to secrets and related resources"+ },+ {+ label: "Secret Editing Policies",+ value: "secret-editor",+ description: "Grants read and edit access to secrets and related resources"+ }+];++const PolicyOptionRow = ({ children, ...props }: OptionProps<PolicyOption>) => (+ <components.Option {...props}>+ <div className="flex items-center justify-between gap-2">+ <div className="min-w-0 flex-1">+ <p className="truncate">{children}</p>+ <p className="text-xs text-muted">{props.data.description}</p>+ </div>+ <Tooltip defaultOpen={props.data.value === "secret-viewer"}>+ <TooltipTrigger type="button" aria-label={`View ${props.data.label}`}>+ <InfoIcon className="size-4 text-muted" />+ </TooltipTrigger>+ <TooltipContent side="left">Secrets: Read</TooltipContent>+ </Tooltip>+ </div>+ </components.Option>+);+/*** `FilterableSelect` is the v3 react-select-based dropdown for searchable* single or multi selection over a known set of options. Reach for it when the@@ -157,6 +191,26 @@ export const Grouped: Story = {)};+export const WithTooltipOption: Story = {+ name: "Example: Tooltip Inside Menu",+ parameters: {+ docs: {+ description: {+ story:+ "Option content can open a portaled tooltip above the select menu. This composition documents the overlay order used when an option needs secondary detail."+ }+ }+ },+ render: () => (+ <FilterableSelect+ menuIsOpen+ options={POLICY_OPTIONS}+ placeholder="Select additional privileges..."+ components={{ Option: PolicyOptionRow }}+ />+ )+};+export const WithLabel: Story = {name: "Example: With Label",parameters: {diff --git a/frontend/src/components/v3/generic/ReactSelect/styles.ts b/frontend/src/components/v3/generic/ReactSelect/styles.tsindex 532874a284..60967f7e6b 100644--- a/frontend/src/components/v3/generic/ReactSelect/styles.ts+++ b/frontend/src/components/v3/generic/ReactSelect/styles.ts@@ -54,7 +54,7 @@ export const selectStyles: StylesConfig<unknown, boolean, GroupBase<unknown>> =}),menuPortal: (provided) => ({...provided,- zIndex: 99999,+ zIndex: 60,pointerEvents: "auto"})};diff --git a/frontend/src/components/v3/generic/Tooltip/Tooltip.tsx b/frontend/src/components/v3/generic/Tooltip/Tooltip.tsxindex 27622813aa..7f1f6320a1 100644--- a/frontend/src/components/v3/generic/Tooltip/Tooltip.tsx+++ b/frontend/src/components/v3/generic/Tooltip/Tooltip.tsx@@ -42,7 +42,7 @@ function TooltipContent({data-slot="tooltip-content"sideOffset={sideOffset}className={cn(- "pointer-events-none z-[70] w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-sm bg-border px-3 py-1.5 text-xs text-pretty text-foreground fade-in-0 select-none zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",+ "!pointer-events-none z-[70] w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-sm bg-border px-3 py-1.5 text-xs text-pretty text-foreground fade-in-0 select-none zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",className)}{...props}