Skip to content

Failed to override styles when selectors are grouped #495

Answered by layershifter
Yixian15 asked this question in Q&A
Discussion options

You must be logged in to vote

There's no way to override styles of ':focus-within' without affecting the styles of ':active', right? I think this could be a problem.

You are correct. There is no predictable way to override it. I created #499 to introduce a lint rule.


Now you can do a nasty hack to increase specificity:

const useClasses = makeStyles({
  c: {
    ':hover&': {
      color: 'blue',
    },
  },
});

// ⬇️⬇️⬇️
// .fms2va0:hover.fms2va0 { color: blue; }

https://stackblitz.com/edit/stackblitz-starters-2xtajv

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Yixian15
Comment options

@layershifter
Comment options

Answer selected by Yixian15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #490 on January 23, 2024 11:05.