deseretdigital-ui / CSS-Guidelines

High-level guidelines for writing manageable, maintainable CSS
0 stars 0 forks source link

data-ui-component attribute #14

Open jehoshua02 opened 9 years ago

jehoshua02 commented 9 years ago

In CSS Selectors: Naming UI Components, I thought it strange to use a data-ui-component attribute that has no effect other than to communicate something not conveyed already in the code. I struggle to understand when we would use this.

Before Closing Issue:

rsahlstrom commented 9 years ago

Think of it as a comment describing what the code block is doing. We're naming our classes so they are reusable and as a result you may not know exactly when looking at the code that the block you're editing is the main nav. By adding a comment to your code, you can immediately know what you're looking at.

rsahlstrom commented 9 years ago

@deseretdigital-ui/front-end-developers

jehoshua02 commented 9 years ago

@deseretdigital-ui/front-end-developers

@janiv Is there harm in using a class for that?

rsahlstrom commented 9 years ago

Your classes should be broad enough to be reused. You should never really have a main-nav class as that instantly becomes un-reusable.

jehoshua02 commented 9 years ago

So ALL classes should be reusable. I missed that principle.

hhatfield commented 9 years ago

@jehoshua02 even if the class name did not need to be reusable, why would putting the name there be better than in the data-ui-component attribute?

jehoshua02 commented 9 years ago

My opinions aren't strong enough to argue either way quite yet.

hhatfield commented 9 years ago

FTFY! Also, If there's not a strong opinion, then I would recommend going with what someone else has already decided.