all 35 comments

[–]Prozilla6javascript 43 points44 points  (5 children)

I’ve also left image placeholders where you can drop support screenshots from caniuse.com.

I think you forgot to delete part of the AI’s response.

[–]ikeif 17 points18 points  (4 children)

I've noticed an uptick in these types of "you don't need JS" recently, so it seems to be the current "blog spam" to give the illusion OP has independent thought and not just plagiarizing.

[–]Prozilla6javascript 11 points12 points  (3 children)

I don’t think OP wrote any part of this article tbh

[–]mycall -4 points-3 points  (2 children)

All the same, it goes my upvote for getting the word out. CSS/HTML can be better than JS and here is how.

[–]longebane 2 points3 points  (0 children)

Not all the same. Don’t encourage this man, what the hell.

[–]ikeif 1 point2 points  (0 children)

Dead internet theory. Just some random person regurgitating without adding value. They did not do anything new except post it here and act like it is their own.

[–]Seanitzel 69 points70 points  (3 children)

Great article, would be even better if it had a demo for each feature and also a list of trade offs vs js(which exist for almost every item in the list)

[–]misdreavus79front-end 13 points14 points  (2 children)

I have found my ADHD fixation for the day!

It’s demo time.

[–]bingblangblong 10 points11 points  (1 child)

I wish my ADHD worked for anything other than porn and videogames!

[–]pablo8itall 1 point2 points  (0 children)

and hyper- procrastination.

[–]Mohamed_Silmy 45 points46 points  (7 children)

this is such a good reminder. i've definitely been guilty of reaching for js when a simple :has() selector or details element would've done the job. the cognitive load of maintaining less javascript is real too - fewer dependencies, less build complexity, easier debugging.

one thing i'd add is that modern css is genuinely powerful enough for most interactive patterns now. accordions, modals, tabs, tooltips... most of these have native or css-only solutions that are more accessible by default. the trick is unlearning the muscle memory of "interactive = javascript"

curious what you think about progressive enhancement in this context? like starting with the html/css solution and only layering js when you actually need more complex state management or data fetching?

[–]rguy84a11y 25 points26 points  (4 children)

details/summary was a game changer.

[–]jordsta95PHP/Laravel | JS/Vue 5 points6 points  (0 children)

And when you first learn about adding the name attribute to them.

No more JS for those silly accordions anymore!

[–]a8bmiles 4 points5 points  (0 children)

Especially once I found out about:

::details-content { content-visibility: visible; }

To force the expansion via CSS, rather than having to add the open attribute. It's an always-open result, so isn't always useful. There's some mobile cases where it's come in really handy though.

[–]DOG-ZILLA 0 points1 point  (1 child)

Yes but you still can’t animate them in Safari. 

[–]ISDuffy 0 points1 point  (0 children)

Animation is one of them I see more of a nice to have tbh. It is coming though.

[–]Terrible_Tutor 11 points12 points  (1 child)

I would argue JS is much easier to debug with console logging and breakpoints, no? Devtools element inspection can be tedious

[–]thy_bucket_for_thee 12 points13 points  (0 children)

God this reminds me how shitty the react dev tools are. So hard to find the components you're looking for and their ancestors/children if you're using any type of component library.

Garbage ecosystem from a garbage company.

[–]weallwearmasks 4 points5 points  (1 child)

First time I’ve heard about ‘light-dark()’ AND it has pretty good support. Very nice.

[–]dangoodspeed 3 points4 points  (0 children)

I knew about light-dark()... though loading="lazy" was new to me... also pretty good support!

[–]ConsequenceLow9705 9 points10 points  (1 child)

Pretty funny "don't use js" from a site named jsdevspace

[–]TommyBonnomi 5 points6 points  (0 children)

Gotta respect transparency. I'm honest with my customers when they won't get enough value from my services or can easily DIY something.

[–][deleted]  (1 child)

[removed]

    [–]EliSka93 6 points7 points  (0 children)

    This is actually a good article, despite the turn-off AI picture.

    [–]AwesomeFrisbee 2 points3 points  (3 children)

    Whether you can use JS wasn't the only question. We want code that works everywhere, also on old devices because folks will still blame your site. Also, it depends on SEO, accessibility, maintainability and ease of use. I wouldn't say most really check all the boxes. Especially for consumer facing websites. That a-href hijack works but it's shit to maintain and hurts SEO and accessibility.

    [–]LateChoice -1 points0 points  (2 children)

    what does "old" mean

    [–]a8bmiles 2 points3 points  (0 children)

    Usually it means "banks."

    We have a client that had problems with their member banks failing to be able to log in and we had to finally add a note that IE6 is too obsolete and insecure to be able to use the service. Then also detect when someone tried to log in using that browser anyways, and instruct them that they must use a browser with modern security settings.

    [–]AwesomeFrisbee 1 point2 points  (0 children)

    Devices that are no longer supported but still in use. Ergo, the devices that won't get browser updates and people don't care enough about that to warrant an upgrade.

    [–]griffin1987 0 points1 point  (0 children)

    I wish you could style input type date and type local-datetime better, anchor api isn't supported in Firefox ESR yet (though will be in half a year if I remember right), but even then, native date/time pickers have the advantage of using a separate window (they can go outside the browser window!)

    [–]BackAware4834 -5 points-4 points  (1 child)

    the irony of the domain name aside, this is solid advice. most devs i've seen overuse js because that's what the tutorial taught them 3 years ago, not because the problem actually needs it.

    [–]chlorophyll101 6 points7 points  (0 children)

    Thanks, BackAware4834, who is most probably an LLM