Live data from Hacker News

Replacing JavaScript with Just HTML

htmhell.dev

271–280 of 296 posts

Re: Replacing JavaScript with Just HTML

#271

Earlier quoted context omitted.

Open an issue with your browser or OS

Default styling being ugly is often for backwards compatibility with older sites so their look stays as consistent as possible. For that reason opening an issue is likely a waste of time for GP and for the devs. They also are most certainly quite aware of how the default styling looks in their browser. It wasn't an oversight. That's not to say it doesn't pain them, it often does, but it has been intentional

Usually it looks however the native OS toolkit looks, just like everything else in browser. This is pretty new (and not well adopted) tech so it's not about legacy styling considerations (like, say, the default CSS for text being so awful) but rather that the OS no longer looks the way people want it to look by default.

Re: Replacing JavaScript with Just HTML

#272

Earlier quoted context omitted.

I can't see how a bunch of esoteric incantations are better than just some straight-forward easy to understand and follow JavaScript.

JavaScript encumbered pages break at least once for NoScript users.

To be fair, that's on the user. It's a trade-off the user is making, knowing that there's poorly made sites out there and sites that actively depend on JavaScript to function (sometimes because JavaScript is the only way they can function, but usually because someone's never heard of progressive enhancement). In the past, turning off JavaScript was a functional way to prevent things from running and to make sites load faster; today ads and progressive enhancement and optional functionality are hardly the only usage of JavaScript: lazy loading variable-size content (via fragments or otherwise) causes scroll issues if you're trying to go for performance on a complex layout. CSS containment and content-visibility with contain-intrinsic-size help solve this, but they're pretty new.

Re: Replacing JavaScript with Just HTML

#273
post #244

Earlier quoted context omitted.

for "accessible", do you mean getting focused when pressing TAB key?

Here is a non-exhaustive list of issues you'll run into with various pure HTML and CSS implementations: - Tabs should have an ARIA "tab" role [1], but doesn't accept roles [2]. - Focusing a tab must activate the corresponding tab panel [3], which requires JavaScript. - Tabs should be navigable by arrow keys [4], which also requires JavaScript. I want to be clear that I'm not trying to tear down your work. Your projec…

> Tabs should be navigable by arrow keys [4], which also requires JavaScript.

It supports this now (with JavaScript). If not, try to refresh the page.

Re: Replacing JavaScript with Just HTML

#274

Earlier quoted context omitted.

I know for sure that Apple, who has an important seat on the standard committee, holded back innovation for so long, it's not a matter of finding or not finding solutions. They're failing us for different interests

> I know for sure that Apple, who has an important seat on the standard committee, holded back innovation for so long, it's not a matter of finding or not finding solutions. They're failing us for different interests Apple isn't the problem. Apple was the first to ship :has(), which developers wanted for 20 years but was thought to be essentially impossible to implement [1]. Apple pushed to get consensus on how to im…

Oh please they pushed back pwas for "security reasons" for years. Safari is the browser with most quirks compared to FF and Chrome, it's considered by many the new IE holding back innovation. Sure they implemented some stuff before other who cares of changes that don't disrupt their apple store model? I don't want mansonry layout if not for designers portfolio or blog? I develop serious appa and I want an api to invent my own layout and I want feature parity with native apps

Re: Replacing JavaScript with Just HTML

#275
My personal pet-peeve everytime a "you don't need JS" post comes up on HN, is the disconnect between the interface designers and the developers. In my dayjob as a (mostly react) freelance contractor doing B2B and LoB apps, there are always UX designers coming up with the screen- and interface designs. I don't think any project I ever were, could have matched a screen design I was passed without JS. Whether it being business requirements (has to work in IE, or nowadays has to work in Edge), or simply hard visual design choices.

My favorite example is that of a date, date-time or date-range picker. Yes, there are HTML native elements. But they look absolutely ugly, styling only goes so far, and good luck with requirements such as "oh, but in the popup on the date-range picker, add a topbar with 3 buttons that trigger preselection and a dropdown". Now you can argue and communicate back that we save a lot of technical complexity in the stack if we stick to the HTML native solutions. But all those discussions basically end up managers and UX designers having no clue about the actual complexity and savings (time and money wise for future maintenance) and simply don't care.

And if I am the one telling them "Look, in the HTML native date-time picker, you can't add custom elements, you can't fully customize every bit and piece of behaviour so change the screen designs" they will just fire up random corporate website XYZ and show a similar version of what they have in mind (and it is always JS-based) and suddenly it looks like me being unable or unskilled to achieve something, that is clearly doable as others have done it.

Now not all is nice and shiny in the JS/React world. We use MaterialUI in a current project, and the commercial MUI-X DatePickers. They also come with their limitations, but it is just they are far more powerfull and customizable to actually meet the requirements and demands of UX and management, compared to the HTML versions.

Re: Replacing JavaScript with Just HTML

#276
post #220
post #181

Earlier quoted context omitted.

Is that "straight-forward easy to understand and follow JavaScript" the whole thing written from scratch? Or does it use libraries (that use libraries, that use libraries)? Because I've written my share of javascript-from-scratch in my time - before npm and such. And even if my use-case was limited, in order to get edge-cases and details working - issues long solved by their HTML/CSS counterparts - we needed more and…

using flags for language is a bad pattern I wish would die. I'm not clicking on the British flag!

Certainly. But the problem here wasn't "we want flags", but that the client (via the designer) demanded something that couldn't fit in a select box and so we had to build our own.

Now, I think part of the problem is that such elements weren't architectured properly when invented. Like many other HTML elements, they should've had some way to style and/or improve them.

E.g. an H1 Header, I can apply CSS to and change it from the default to something matching the business style. I can add some behaviour to it, so I can bookmark it's id anchor. I can add some behaviour to turn the H1-6 into a nice table-of-contents. Or an image can be improved with some CSS and JS to load progressively. But most form elements, and the dropdown in particular, is hard to improve.

And, yes, I am aware of the can of worms if "any element is allowed inside an ". Or the misuse designers will do if we can add CSS to certain or their contents. Though I don't think "webdevs will abuse" was ever the reason not to hand power to them. It was mostly a disconnect between the "designers of the specs" and the "designers/builders of websites".

Because that "abuse" is never worse than what is still done en-masse: where we simply replace the "select" with hundreds of lines of CSS, divsoup, and hundreds or thousands of lines of JS. Where entire component libraries exist and used all over the place, that completely replicate the behaviour of existing (form) elements but with divs/spans, css and js. And despite the thousands of hours of finetuning, still get details wrong in the area of a11y, on mobile platforms, on obscure platforms, with a plugin, with a slow connection and so on.

Re: Replacing JavaScript with Just HTML

#278
post #49

Earlier quoted context omitted.

like what?

Tabs, accordion, combobox. There is a whole lot more, these are just the ones I can remember now.

For tabs, see: https://lyra.horse/blog/2025/08/you-dont-need-js/#lyres-and-...

As far as I can tell, my implementation there fits the guidelines.

Re: Replacing JavaScript with Just HTML

#279
post #45

Earlier quoted context omitted.

> 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.

That is no longer true! You can do it in CSS with a combination of `@starting-style` and `transition-behavior: allow-discrete`. [1] Another gotcha you'll run into is animating the height. A couple other new features (`interpolate-size: allow-keywords` and `::details-content`) will let you get around that. [2] Modern CSS is awesome. [1] https://developer.chrome.com/blog/entry-exit-animations [2] https://nerdy.dev/open…

* Only works on chromium browser for now.

** Works badly even on chromium browsers (granted I was doing weird stuff, but the animation did not work properly).

I estimate that in a few years we will have animations working properly and mostly everywhere on details elements. Not before.

Re: Replacing JavaScript with Just HTML

#280
post #276
post #220

Earlier quoted context omitted.

using flags for language is a bad pattern I wish would die. I'm not clicking on the British flag!

Certainly. But the problem here wasn't "we want flags", but that the client (via the designer) demanded something that couldn't fit in a select box and so we had to build our own. Now, I think part of the problem is that such elements weren't architectured properly when invented. Like many other HTML elements, they should've had some way to style and/or improve them. E.g. an H1 Header, I can apply CSS to and change i…

Luckily things are slowly changing for the better. You can actually style a now! Browser support is still scant but it'll gracefully degrade to a normal looking . https://developer.mozilla.org/en-US/docs/Learn_web_developme...
Post reply on HN