Skip to content

Shortcut expansion silently drops variant utilities (hover:/focus:/active:) #18

Description

@glennmichael123

A shortcut like:

shortcuts: {
  'btn-primary': 'bg-accent text-white hover:bg-accent-2',
}

generates only .btn-primary { background-color: var(--accent); color: #fff; } — the hover:bg-accent-2 part produces no CSS at all (expected: a .btn-primary:hover { background-color: var(--accent2) } rule). Same for focus:/active: variants. No warning is emitted, so an entire design system's interactive states can silently not exist — this is exactly what happened in stacksjs/ts-analytics: every shortcut-styled button was hover-dead, and standalone hover:* utilities in markup generate fine, which masks the gap.

Verified by diffing the generated CSS: 9 of 10 shortcut hover variants missing (the one present came from hand-written CSS, not the shortcut).

Workaround shipped in ts-analytics: hand-written :hover/:active rules alongside the shortcuts. Ask: expand variants inside shortcut definitions into pseudo-class rules on the shortcut selector — or warn loudly when dropping them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions