-
Notifications
You must be signed in to change notification settings - Fork 175
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
Pseudo selectors. #29
Comments
Variants ( .user-link:hover { ... }
.user-link > .name:hover { } Related: #30 |
Yeah, there is always that route. However what I meant with variants is maybe something like this: .foo-bar
> .baz
background-color:blue;
width:200px; height:200px;
&.-hoverable:hover
background-color:red; (Stylus) Then you can structure your HTML like this: <div class='foo-bar'>
<div class='baz -hoverable'></div>
<div class='baz -hoverable'></div>
<div class='baz'></div>
</div> Makes it feel more flexible. Like in this scenario you can opt out of the hover styles if you want, rather than having to use a helper to overwrite them. Maybe you could touch up on that in the guide? Or do you think it's best left open to the developer? |
I also think the variants are better JS-wise. Since it's easier to toggle a class than it is multiple styles. |
Ah, I see what you mean. It certainly makes sense to make the hovering behavior an opt-in variant for some scenarios. However, it seems like a use case that's pretty specific, whereas RSCSS right now only contains general guidelines. Another way to approach this would perhaps be to only enable hoverability only for elements where they make sense. For instance, in a menu with links (let's call it .menu-item {
/* ... */
}
a.menu-item,
button.menu-item {
&:focus,
&:hover {
/* hover styles */
}
} But yes, it might be worth writing more material for specific cases such as these in a new chapter. |
On that matter, I've recently came across this article from the eBay engineers. Example ported in RSCSS Instead of using a
|
@albertorestifo Wouldn't the HTML5 "hidden" attribute be easier? <div hidden></div> |
@bash Well, the main issue here is that I was not aware of that attribute 😄 |
Since RSCSS is just a guideline, quite a bit of it is open to interpretation...
Should I delegate pseudo selector events like
:hover
,:active
, and:focus
to the elements themselves, or through a variant?I feel like having them be declared through variants is the better option, but I'm not really a front-end expert.
Perhaps you could touch a little bit on them. I'd like to know a good style to declare them in since pretty much everything else defined in the guide I agree with and like.
The text was updated successfully, but these errors were encountered: