cssinjs / cssinjs/styled-jss

Mixing style objects and functions messes up specificity resolution

Open
#74 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
214
Forks
14
PR merge metrics
No merged PRs in 30d

Description

Expected:
```tsx
const Title = styled("h1")(p => ({
background: "blue"
}));

const Title2 = styled(Title)({
background: "green"
});
```

Expected:
Title2 is green

Resulted:
Title2 is blue, because it has 2 class names and one of them loses the specificity war.

Repro:
https://codesandbox.io/s/styled-jss-playground-repro-mo3c8

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked CodeSandbox reproduction and compare the generated styles for Title and Title2. Trace how styled components combine function-based and object-based styles and how their class names affect specificity. Done means Title2 renders with a green background instead of blue, with the reproduction behavior covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.