cssinjs / cssinjs/jss

Using arrow function on jss-rtl dependent property does not works well

Open
#1,234 10 comments 4 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

__Expected behavior:__

The rtl plugin should switch the styles.

__Describe the bug:__

The rtl plugin doesn't switch all the styles.

```js
const useStyles = createUseStyles({
myButton1: {
paddingLeft: "16px" ✅
},
myButton2: {
paddingRight: ({ isMobile }) => (isMobile ? 0 : "26px") ❌
},
myLabel: props => ({
paddingRight: "8px" ✅
})
});
```

__Codesandbox link:__

https://codesandbox.io/s/react-jss-playground-37lqs

__Versions (please complete the following information):__
- jss: 10.0.0
- Browser [e.g. chrome, safari]: all
- OS [e.g. Windows, macOS]: all

First reported in https://github.com/mui-org/material-ui/issues/18477.

Contributor guide

Open the contributing guide

Research direction

Start by running the linked CodeSandbox with jss 10.0.0 and comparing the three style cases shown in the issue. Trace how the rtl plugin handles the arrow-function value for paddingRight, then verify that the dependent property is switched consistently while the existing cases remain correct.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.