Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hover on parent element #42

Open
ianobermiller opened this issue Sep 25, 2014 · 3 comments
Open

Hover on parent element #42

ianobermiller opened this issue Sep 25, 2014 · 3 comments

Comments

@ianobermiller
Copy link

Has anyone thought about how to convert the following CSS without using an event handler?

.parent {
  background: white;
}
.child {
  color: black;
}

.parent:hover {
  background: black;
}
.child:hover {
  color: white;
}
@charliermarsh
Copy link
Collaborator

We support pseudo-elements with the following syntax:

var parentStyle = RCSS.registerClass({
  background: 'white',
  ':hover': {
    background: 'black'
  }
});
var childStyle = RCSS.registerClass({
  color: 'black',
  ':hover': {
    color: 'white'
  }
});

I think that's sufficient for this case, right?

@ianobermiller
Copy link
Author

No, that is different semantics. That will only change the child style when you hover over the child; the expected behavior is to make the child color white when hover over anywhere on the parent.

@bitplanets
Copy link

The current solution is to use state in react and based on that change classes or inline styles. I dislike a bit, but goes toward the ideology of this lib, which seems to be a good one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants