by cxr · 4y ago · 0 comments
One unfortunate side effect of things like Tailwind CSS is that some folks with a single-minded focus on looks are now using only the Tailwind class names, but you can do both. If before you'd have written something like class="video-thumbnail" and styled the content with a class selector in your CSS, but now you've adopted Tailwind and have excised all the descriptive class name from the content (rather than just rming your stylesheet and adding Tailwind classes to whatever class names are already there), then please put the descriptive class names back in! And if you have colleagues submitting patches that remove class names because you're migrating to Tailwind, tell them to use Tailwind classes in a way that adds to the classification instead of as a replacement for traditional, descriptive class names.
(A similar thing happens with CSS compilers. The autogenerated stuff served up on podcasts.google.com is nasty, for example.)
Like, what is this additional data layer actually for? What humans or software use it?
I don't know. That's your word. You're the one who wrote it. I'm asking you.
> faking it with semi-semantic class names
Huh?
Are you really suggesting that people should make Cascading Style Sheets do more than styling? We have literal entire specs for using correct attributes for accessibility and microformats. WAI, ARIA, and so on.
Furthermore, from the authors of Tailwind, Headless UIhttps://headlessui.com/ is a collection of fully unstyled logic components with their primary concern being accessibility (done correctly, with aforementioned attributes, not random class names). At no point have users or maintainers of Tailwind tried to steer people away from including accessibility or microdata in their designs.
This feels like an incredibly thinly veiled attack on Tailwind by the ever vocal anti-Tailwind interest group for something it shouldn't be doing anyway.
No. I'm talking about the class attribute, not style sheets. The single-minded minded Web developers with a focus only on styling that I mentioned seem to have formed the belief that class names are just "a CSS thing" (or something)—and that's the problem.
> At no point have users or maintainers of Tailwind tried to steer people away from including accessibility or microdata in their designs.
K. Who're you arguing with you here?
> This feels like an incredibly thinly veiled attack on Tailwind by the ever vocal anti-Tailwind interest group
Consider that leaping to conclusions like this indicates that you might be living in a bubble. (See "single-minded focus".) I'm not part of some rival frontend gang. I don't even exist in the milieu—the world is way bigger than visual designers doing Web work who spend their discretionary time talking about the trade.
Again with the attacks.
There is no evidence that eg Google uses arbitrary class names in order to index metadata over the accepted standards of microdata.
https://developers.google.com/search/docs/advanced/structure...
Given I know what microdata is, when to use it, and how it's different to CSS, I'm not sure what bubble this would be. Perhaps the one that is familiar with Google crawling?
> There is no evidence that eg Google uses arbitrary class names in order to[...]
Again: who are you arguing with? Every response you've written here has the quality of being written as if addressing someone or something that doesn't even appear in the discussion.
> I'm not sure what bubble this would be
The one that goes (roughly), "clearly I am addressing a fellow tradesperson who is biased against other factions, and therefore it is reasonable to declare this to be a thinly veiled attack that I have assumed it is". If you spend your time squabbling with colleagues (and/or trying to deflect attacks on Twitter[1]), and when you come across someone you immediately leap to the conclusion that they're working against you[1] on professional–ideological grounds, then there might be some bubble-backed paranoia at work.
I don't care about your opinionated in-trade squabbles. I don't occupy either "side" of the debate that you've tried to insert me into* any more than your aunts and uncles and grandparents do. (What are their thoughts on going with Tailwind versus not? I suppose they'll let you know when they get their first client for frontend work and it comes up—or even could come up—right? Me too. Until then...)
* and this is all not even to mention—as the other person who responded to you pointed out—that the position you attributed to me is completely opposite of what I actually wrote
The parent made no such suggestion. You seem to be conflating the purpose of HTML classes with CSS. Here's a note from the "literal entire spec"[0], which other commenters have already pointed out:
> […] authors are encouraged to use values that describe the nature of the content, rather than values that describe the desired presentation of the content.
Furthermore, the parent took great pains not to attack Tailwind, instead pointing out that the two different approaches could easily coexist.
If you'd like to use class names solely as CSS hooks, go right ahead, but citing "correct attributes" is ironic at best.
[0]: https://html.spec.whatwg.org/multipage/dom.html#global-attri...
https://developers.google.com/search/docs/advanced/structure...
Of course, having well considered structured semantic works very well!
For instance, with images, you can use attached caption markup to describe an images purpose and reference it in the written body of the document.
There's no such thing. There are already detailed comments in this thread about this mixup.
You're better off using another attribute, e.g. some data-* attribute, for semantic information.
> […] authors are encouraged to use values that describe the nature of the content, rather than values that describe the desired presentation of the content.
[*]: https://html.spec.whatwg.org/multipage/dom.html#global-attri...
But describing the presentation of content isn't the sole purpose of the `class` attribute. Having meaningful domain-related names included in the class makes UI testing a lot easier.
It's as easy as:
<img class="video-thumbnail w-24 h-24 rounded shadow"[...]
... instead of swapping out "video-thumbnail" class name with the Tailwind stuff (replacing it). They are not mutually exclusive.You, like several others commenters seem to have an internalized belief (probably based on assumption/association?)* that content class names are a contribution of the CSS spec. (This is the only way to interpret your "overloading" remark.)
Just because you can use the classes in your CSS as selectors doesn't mean that classes are just a CSS "thing" (or whatever) and that doing something else with them is "overloading" them. That's silly. The class attribute is for, like, you know, specifying the class of the content.
* (This raises the question: Is the word "class" just an opaque token to people? They've never typed out the sequence 'c', 'l', 'a', 's', 's', '=' and pondered it at all? Or do they, but it's limited to something akin to, "If you want to put a border or something then you put 'class' here on the element and then you can CSS it. I dunno why they called it that, but that's what you write, and it lets you do the border later." What do they think of the fact that you can also create CSS selectors based on element ID? Are element IDs, then, another just-a-CSS-thing in their minds? Or what about that you can make selectors using the element name itself? Or that class selectors are not the default—if you want to use a class-based selector in a style rule, you actually have to escape from the default mode by using a leading dot to specify that what follows should be interpreted as a class name? If classes were strictly within the purview of CSS, shouldn't the class selector be the default...?)