Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(ui-patterns): give the shared InfoTooltip trigger an accessible name (#49345)

Miranda Limonczenko932180541e3c
diff --git a/apps/www/app/pricing/PricingContent.tsx b/apps/www/app/pricing/PricingContent.tsx
index ed8cead6dd4..a69bcb8d69e 100644
--- a/apps/www/app/pricing/PricingContent.tsx
+++ b/apps/www/app/pricing/PricingContent.tsx
@@ -77,7 +77,7 @@ export default function PricingContent() {
<div className="flex items-center justify-center gap-1">
<span className="py-1 px-3 bg-surface-100 flex items-center gap-1 border rounded-full text-xs text-foreground-lighter">
What is &ldquo;compute&rdquo;?
- <InfoTooltip side="bottom" className="max-w-[280px]">
+ <InfoTooltip side="bottom" className="max-w-[280px]" label="About compute">
Think of compute as the computer your database runs on. As your app grows, you scale
CPU and memory to handle more traffic and data.
</InfoTooltip>
diff --git a/apps/www/components/Pricing/ComputePricingCalculator.tsx b/apps/www/components/Pricing/ComputePricingCalculator.tsx
index 117729ba707..130d4f6b523 100644
--- a/apps/www/components/Pricing/ComputePricingCalculator.tsx
+++ b/apps/www/components/Pricing/ComputePricingCalculator.tsx
@@ -153,7 +153,7 @@ const ComputePricingCalculator = ({
<div className="flex items-center gap-1 w-full justify-between">
<span>Total</span>
<span className="text-foreground font-mono flex items-center gap-1">
- <InfoTooltip side="top" className="max-w-[250px]">
+ <InfoTooltip side="top" className="max-w-[250px]" label="About this estimate">
This estimate only includes Plan and Compute add-on monthly costs. Other resources
might incur additional costs in the final invoice.
</InfoTooltip>
diff --git a/apps/www/components/Pricing/PricingTableRow.tsx b/apps/www/components/Pricing/PricingTableRow.tsx
index 38684a0388d..f9bd8626458 100644
--- a/apps/www/components/Pricing/PricingTableRow.tsx
+++ b/apps/www/components/Pricing/PricingTableRow.tsx
@@ -193,7 +193,7 @@ export const PricingTableRowDesktop = (props: any) => {
>
<span className="mr-1">{feat.title}</span>
{tooltips?.main && (
- <InfoTooltip side="top" className="max-w-[250px]">
+ <InfoTooltip side="top" className="max-w-[250px]" label={`About ${feat.title}`}>
{tooltips.main}
</InfoTooltip>
)}
@@ -221,7 +221,11 @@ export const PricingTableRowDesktop = (props: any) => {
<div className="text-foreground text-xs flex flex-col justify-center">
<span className="flex items-center gap-2">
{tooltips?.[planName] && (
- <InfoTooltip side="top" className="max-w-[250px]">
+ <InfoTooltip
+ side="top"
+ className="max-w-[250px]"
+ label={`About ${feat.title} on the ${planName} plan`}
+ >
{tooltips[planName]}
</InfoTooltip>
)}
diff --git a/packages/ui-patterns/src/info-tooltip.tsx b/packages/ui-patterns/src/info-tooltip.tsx
index ad06747e994..87ef4896f0c 100644
--- a/packages/ui-patterns/src/info-tooltip.tsx
+++ b/packages/ui-patterns/src/info-tooltip.tsx
@@ -22,16 +22,16 @@ const SVG = forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement>>((props, ref
const InfoTooltip = forwardRef<
ElementRef<typeof TooltipContent>,
- React.ComponentPropsWithoutRef<typeof TooltipContent>
->(({ ...props }, _ref) => {
+ React.ComponentPropsWithoutRef<typeof TooltipContent> & { label?: string }
+>(({ label, ...props }, _ref) => {
return (
<Tooltip>
<TooltipTrigger
type="button"
- role="button"
className="flex [&_svg]:data-[state=delayed-open]:fill-foreground-lighter [&_svg]:data-[state=instant-open]:fill-foreground-lighter"
>
<SVG strokeWidth={2} className="transition-colors fill-foreground-muted w-4 h-4" />
+ <span className="sr-only">{label ?? 'More information'}</span>
</TooltipTrigger>
<TooltipContent {...props} />
</Tooltip>