Skip to content

fix(core): preserve solid primary button text color on hover and extract PrimitiveButton - #5522

Open
ayushsinghbodra-jpg wants to merge 3 commits into
BuilderIO:mainfrom
ayushsinghbodra-jpg:main
Open

ayushsinghbodra-jpg wants to merge 3 commits into
BuilderIO:mainfrom
ayushsinghbodra-jpg:main

Conversation

@ayushsinghbodra-jpg

Copy link
Copy Markdown

Description

Closes #5493.

Root Cause

Three core client files defined private Button wrappers around the toolkit Button that forced variant="ghost" and unconditionally appended hover:text-inherit:

  • packages/core/src/client/org/TeamPage.tsx (TeamPrimitiveButton)
  • packages/core/src/client/settings/SettingsPanel.tsx (SettingsPrimitiveButton)
  • packages/core/src/client/settings/SecretsSection.tsx (SecretsPrimitiveButton)

When reused for solid primary actions on those surfaces (intent="primary" emphasis="solid" with bg-primary text-primary-foreground), Tailwind's :hover pseudo-class matching caused hover:text-inherit to take precedence over text-primary-foreground on hover, turning white labels dark or illegible against the primary background.

Changes

  1. Extracted Shared PrimitiveButton: De-duplicated the three wrappers into a single shared PrimitiveButton in packages/core/src/client/ui/PrimitiveButton.tsx and re-exported it from packages/core/src/client/ui/index.ts.
  2. Conditional Ghost Hover Reset: Implemented typed resolvePrimitiveButtonEmphasis and isGhostEmphasis so hover:bg-transparent hover:text-inherit is only applied when the resolved visual emphasis is "ghost" or "ghost-inset". Solid, outline, and other non-ghost buttons omit the hover reset entirely.
  3. Call-site Refactoring: Updated TeamPage.tsx, SettingsPanel.tsx, and SecretsSection.tsx to import PrimitiveButton as Button, maintaining 100% API and prop compatibility.
  4. Unit & Integration Tests:
    • Added PrimitiveButton.spec.tsx testing all emphasis resolution branches, solid primary buttons, ghost resets, outline buttons, and theme contrast assertions.
    • Added tests in TeamPage.spec.tsx, SecretsSection.spec.tsx, and SettingsPanel.connections.spec.tsx verifying that solid primary buttons across all three surfaces retain text-primary-foreground and exclude hover:text-inherit.
  5. Changeset: Added patch changeset for @agent-native/core.

Verification

  • pnpm --filter @agent-native/core typecheck: 0 errors
  • All 39 test specs across PrimitiveButton.spec.tsx, TeamPage.spec.tsx, SecretsSection.spec.tsx, and SettingsPanel.connections.spec.tsx passing
  • Guards (guard-no-untracked-imports, guard-no-silent-coercion, guard-no-raw-colors, guard-no-boot-data-work, guard-external-result-contract) passing clean

…act PrimitiveButton

De-duplicate Settings and Team button wrappers into shared PrimitiveButton and apply ghost hover resets conditionally so solid primary buttons retain text-primary-foreground on hover.

Closes BuilderIO#5493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Solid primary buttons in core Settings and Team surfaces lose their label color on hover

1 participant