cssinjs/jss

Wrong CSS specificity

Open

#1,045 建立於 2019年2月25日

在 GitHub 查看
 (6 留言) (2 反應) (1 負責人)JavaScript (7,000 star) (434 fork)batch import
bugcomplexity:moderatehelp wanted

描述

Take the following style as an input:

const style = {
  root: {
    "&:hover": {
      "& .icon": {
        color: "red"
      }
    },
    "&.active": {
      "& .icon": {
        color: "blue"
      }
    }
  },
};

Expected behavior: I would expect the following CSS injected into the page:

.root-0-0-1:hover .icon {
  color: red;
}
.root-0-0-1.active .icon {
  color: blue;
}

Describe the bug: The following CSS is injected in the page:

.root-0-0-1.active .icon {
  color: blue;
}
.root-0-0-1:hover .icon {
  color: red;
}

Codesandbox link:

https://codesandbox.io/s/yjyqmo4vqv

Versions (please complete the following information):

  • jss: 10.0.0-alpha.11

貢獻者指南

Wrong CSS specificity · cssinjs/jss#1045 | Good First Issue