Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/mosaic-item-press-state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
Comment on lines +1 to +2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Populate the changeset for this package change.

Lines 1-2 contain no package bump or release description, so Changesets will not record this packages/ui behavior change for release. Add the appropriate package entry and summary.

Proposed shape
 ---
+'`@clerk/ui`': patch
 ---
+
+Fix Mosaic item pressed-state backgrounds and transitions.

As per coding guidelines, Changesets must manage versioning and changelogs. Based on learnings, delimiter-only changesets are appropriate only for documentation, tooling, or scaffolding changes.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
---
---
---
'`@clerk/ui`': patch
---
Fix Mosaic item pressed-state backgrounds and transitions.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.changeset/mosaic-item-press-state.md around lines 1 - 2, Populate the
changeset front matter with the appropriate version bump for the affected
packages/ui package, then add a concise release summary describing the mosaic
item press-state behavior change. Keep the standard Changesets delimiter format
intact and ensure this is not left as a delimiter-only changeset.

Sources: Coding guidelines, Learnings

23 changes: 21 additions & 2 deletions packages/ui/src/mosaic/components/item/item.styles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as stylex from '@stylexjs/stylex';

import { colorVars, fontWeightVars, radiusVars, space, typeScaleVars } from '../../tokens.stylex';
import { colorVars, durationVars, fontWeightVars, radiusVars, space, typeScaleVars } from '../../tokens.stylex';

export const item = stylex.create({
base: {
Expand Down Expand Up @@ -30,11 +30,24 @@ export const item = stylex.create({
backgroundColor: {
default: null,
':active': `color-mix(in oklab, ${colorVars['--cl-color-neutral']} 8%, transparent)`,
// Hover excludes `:active` explicitly — StyleX doubles the class inside an at-rule, so a
// `@media (hover: hover)` `:hover` outranks the bare `:active` and wins while pressing.
'@media (hover: hover)': {
':hover': `color-mix(in oklab, ${colorVars['--cl-color-neutral']} 4%, transparent)`,
default: null,
':hover:not(:active)': `color-mix(in oklab, ${colorVars['--cl-color-neutral']} 4%, transparent)`,
},
},
cursor: 'pointer',
// The press reads as contact, not a fade, so it lands instantly; release falls back to `fast`.
// Bare `:active`, not `:enabled:active` as on `button` — the row renders as a `div` or an `a`,
// and `:enabled` only ever matches form controls.
transitionDuration: {
default: durationVars['--cl-duration-fast'],
':active': durationVars['--cl-duration-instant'],
},
transitionProperty: 'background-color',
// Linear, not `--cl-ease-default`: nothing here moves.
transitionTimingFunction: 'linear',
},

// vertical density derived from the variant; horizontal padding is shared by the base
Expand Down Expand Up @@ -79,6 +92,12 @@ export const title = stylex.create({
fontSize: typeScaleVars['--cl-text-sm-size'],
fontWeight: fontWeightVars['--cl-font-medium'],
lineHeight: typeScaleVars['--cl-text-sm-leading'],
// Matches the row's background fade so the two settle together. No `:active` branch: the row
// still matches `:hover` while pressed, so the title's color doesn't change on press.
transitionDuration: durationVars['--cl-duration-fast'],
transitionProperty: 'color',
// Linear, not `--cl-ease-default`: nothing here moves.
transitionTimingFunction: 'linear',
},
});

Expand Down
Loading