Live data from Hacker News

Replacing JavaScript with Just HTML

htmhell.dev

41–50 of 296 posts

Re: Replacing JavaScript with Just HTML

#42
post #30

I'm so not impressed by the toggle implementation... How nice it could have been. Nesting the elements is a truly hideous choice. The summary is part of the details?? I thought they were opposites. Should we also put the headings in the from now on? Identifying a target should be done by id or by name. That it does use a name because js can't target it without makes it even more stupid. We already had labels for form…

> Nesting the elements is a truly hideous choice. The summary is part of the details?? I thought they were opposites.

It gives them a semantic connection. Last I checked, HTML isn't really based on giving special meaning to combinations of sibling tags. A summary is part of the thing that conceptually requires detailing.

> If you find 1000 websites using a toggle I doubt there is one using an ugly arrow like that.

I think the default looks fine. But TFA clearly explains right there that it can be styled. (Specifically, by styling ::before on the summary tag.)

> The default styling gives no clue about it being clickable?

You asked what the arrow is, and then asked about the lack of indication that the summary header is clickable. The arrow is exactly that indication.

> Maybe I'm dense but I also want my url to reflect the state of the page.

If you scroll, should the fragment automatically update as you scroll past anchors? I think I'd find that quite annoying.

Re: Replacing JavaScript with Just HTML

#44

Something I keep thinking about when I consider the trade-offs between building a site with HTML/CSS wherever possible vs JS is what the actual _experience_ of writing and maintaining HTML/CSS is vs JS. JS gets knocked around a bunch compared to "real" languages (although less so in recent years), but at the end of the day, it's a programming language. You can write a loop in it. Writing a web server in C++ is a way…

> Writing a web server in C++ is a way to get excellent performance. So why don't most people do it?

Because they already wrote it in C.

Apache and Nginx are both written in C. Together they run 57.7% of all web servers:

https://w3techs.com/technologies/overview/web_server

Re: Replacing JavaScript with Just HTML

#45

The details / summary thing absolutely kills me. There’s basically nothing you can’t do with them. Hiding and replacing markers is easy. But every component library just pretends they don’t exist. It even saves you the effort of all the aria control and expanded tags: these tags don’t need them.

> The details / summary thing absolutely kills me. There’s basically nothing you can’t do with them.

Animating the details element is tricky. By the spec, browsers don’t natively support transitions between display: none and display: block.

Re: Replacing JavaScript with Just HTML

#46
post #45

The details / summary thing absolutely kills me. There’s basically nothing you can’t do with them. Hiding and replacing markers is easy. But every component library just pretends they don’t exist. It even saves you the effort of all the aria control and expanded tags: these tags don’t need them.

> The details / summary thing absolutely kills me. There’s basically nothing you can’t do with them. Animating the details element is tricky. By the spec, browsers don’t natively support transitions between display: none and display: block.

Animating accordions is almost always a bad idea because the content length can make it unbearable.

In general I find animations on the web overused and unnecessary

Re: Replacing JavaScript with Just HTML

#47

When building out a new app or site, start with the simplest solution like the html-only autofilters first, then add complex behavior later. It's good to know these things exist so there are alternatives to reaching for a fat react component as the first step.

Until your client tells you that it doesn't work in Edge and you find out it's because every browser has its own styling and they are impossible to change enough to get the really long options to show up correctly. Then you're stuck with a bugfix's allotment of time to implement an accessible, correctly themed combo box that you should have reached for in the first place, just like what you had to do last week with t…

[deleted]

Re: Replacing JavaScript with Just HTML

#50
post #45

The details / summary thing absolutely kills me. There’s basically nothing you can’t do with them. Hiding and replacing markers is easy. But every component library just pretends they don’t exist. It even saves you the effort of all the aria control and expanded tags: these tags don’t need them.

> The details / summary thing absolutely kills me. There’s basically nothing you can’t do with them. Animating the details element is tricky. By the spec, browsers don’t natively support transitions between display: none and display: block.

[deleted]
Post reply on HN