Skip to content

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

fix(ui): opaque default button hover fills (#48837)

Danny White6c0439ace812
diff --git a/packages/ui-patterns/src/CommandMenu/api/CommandMenu.tsx b/packages/ui-patterns/src/CommandMenu/api/CommandMenu.tsx
index 2c4f75fbf26..4ab24a24862 100644
--- a/packages/ui-patterns/src/CommandMenu/api/CommandMenu.tsx
+++ b/packages/ui-patterns/src/CommandMenu/api/CommandMenu.tsx
@@ -188,9 +188,9 @@ function CommandMenuTriggerInput({
'grow md:min-w-44 xl:min-w-56 h-[30px] rounded-md',
'pl-1.5 md:pl-2 pr-1',
'flex items-center justify-between',
- // Match Button default (Connect): selection hover fill, stronger border.
+ // Match Button default (Connect): opaque popover hover fill, stronger border.
'bg-transparent text-foreground-lighter border border-strong',
- 'hover:bg-selection hover:border-stronger',
+ 'hover:bg-popover hover:border-stronger',
'focus-ring',
'transition-colors',
className
diff --git a/packages/ui-patterns/src/SkipToContent/SkipToContent.test.tsx b/packages/ui-patterns/src/SkipToContent/SkipToContent.test.tsx
index 357de928b64..9c5082795d5 100644
--- a/packages/ui-patterns/src/SkipToContent/SkipToContent.test.tsx
+++ b/packages/ui-patterns/src/SkipToContent/SkipToContent.test.tsx
@@ -26,7 +26,6 @@ describe('SkipToContent', () => {
const wrapper = container.firstElementChild as HTMLElement
expect(wrapper.className).toContain('-translate-y-full')
expect(wrapper.className).toContain('focus-within:translate-y-[10px]')
- expect(wrapper.className).toContain('bg-background')
expect(wrapper.className).toContain('w-fit')
expect(wrapper.className).toContain('left-[10px]')
})
@@ -35,6 +34,7 @@ describe('SkipToContent', () => {
render(<SkipToContent href="#main" />)
const link = screen.getByRole('link', { name: 'Skip to content' })
+ expect(link.className).toContain('hover:bg-popover')
expect(link.className).not.toContain('bg-surface-300')
expect(link.className).not.toContain('hover:bg-secondary')
})
diff --git a/packages/ui-patterns/src/SkipToContent/SkipToContent.tsx b/packages/ui-patterns/src/SkipToContent/SkipToContent.tsx
index 7f8bdc2555d..c07d20eb2a6 100644
--- a/packages/ui-patterns/src/SkipToContent/SkipToContent.tsx
+++ b/packages/ui-patterns/src/SkipToContent/SkipToContent.tsx
@@ -19,9 +19,8 @@ function SkipToContent({ href, children = 'Skip to content', className }: SkipTo
return (
<div
className={cn(
- // Opaque plate so default Button muted/selection fills composite like any other control.
- // w-fit: plate is a block div by default and would otherwise span the full content column.
- 'fixed top-0 left-[10px] z-[100] w-fit rounded-md bg-background',
+ // w-fit: wrapper is a block div by default and would otherwise span the full content column.
+ 'fixed top-0 left-[10px] z-[100] w-fit',
'-translate-y-full focus-within:translate-y-[10px]',
'transition-transform duration-200 ease-out',
className
diff --git a/packages/ui-patterns/src/multi-select/multi-select.tsx b/packages/ui-patterns/src/multi-select/multi-select.tsx
index 6e91d0260ba..2f769935942 100644
--- a/packages/ui-patterns/src/multi-select/multi-select.tsx
+++ b/packages/ui-patterns/src/multi-select/multi-select.tsx
@@ -294,12 +294,12 @@ const MultiSelectorTrigger = React.forwardRef<HTMLButtonElement, MultiSelectorTr
role="combobox"
className={cn(
'flex w-full min-w-[200px] min-h-[34px] items-center justify-between rounded-md border',
- 'border-strong bg-alternative dark:bg-muted px-3 py-1.5 text-sm',
+ 'border-strong bg-background dark:bg-card px-3 py-1.5 text-sm',
'placeholder:text-muted-foreground',
'ring-border-control focus-ring',
'disabled:cursor-not-allowed disabled:opacity-50',
- 'hover:border-stronger hover:bg-selection transition-colors duration-200',
- open && 'bg-selection border-stronger',
+ 'hover:border-stronger hover:bg-popover transition-colors duration-200',
+ open && 'bg-popover border-stronger',
className
)}
{...props}
diff --git a/packages/ui/src/components/Button/Button.tsx b/packages/ui/src/components/Button/Button.tsx
index 04e5499c49f..7b0e556bfce 100644
--- a/packages/ui/src/components/Button/Button.tsx
+++ b/packages/ui/src/components/Button/Button.tsx
@@ -37,9 +37,9 @@ const buttonVariants = cva(
`,
default: `
text-foreground
- bg-alternative dark:bg-muted hover:bg-selection
+ bg-background dark:bg-card hover:bg-popover
border-strong hover:border-stronger
- data-[state=open]:bg-selection
+ data-[state=open]:bg-popover
data-[state=open]:border-button-hover
`,
secondary: `
diff --git a/packages/ui/src/components/shadcn/ui/select.tsx b/packages/ui/src/components/shadcn/ui/select.tsx
index 8b647aa0c2d..d2cdd3087c2 100644
--- a/packages/ui/src/components/shadcn/ui/select.tsx
+++ b/packages/ui/src/components/shadcn/ui/select.tsx
@@ -47,8 +47,8 @@ const SelectTrigger = React.forwardRef<
<SelectPrimitive.Trigger
ref={ref}
className={cn(
- 'flex w-full items-center justify-between rounded-md border border-strong hover:border-stronger bg-alternative dark:bg-muted hover:bg-selection text-xs data-[placeholder]:text-foreground-lighter ring-border-control focus-ring disabled:cursor-not-allowed disabled:opacity-50 transition-colors duration-200',
- 'data-[state=open]:bg-selection data-[state=open]:border-stronger',
+ 'flex w-full items-center justify-between rounded-md border border-strong hover:border-stronger bg-background dark:bg-card hover:bg-popover text-xs data-[placeholder]:text-foreground-lighter ring-border-control focus-ring disabled:cursor-not-allowed disabled:opacity-50 transition-colors duration-200',
+ 'data-[state=open]:bg-popover data-[state=open]:border-stronger',
'gap-2',
'[&>span]:truncate text-left', // [kemal] This is to prevent double lines rendering when a string is particularly long.
SelectTriggerVariants({ size }),