News for hackers. Stuff that matters.
Re:Replacing JavaScript with Just HTML by iammrpayments on Saturday December 27, 2025 @11:10PM (#46408354)
I was trying to rewrite some UI library with html sometime ago following the W3C accessibility specs and found out a lot of patterns can’t be done with pure html and require javascript unfortunately.
Re:Replacing JavaScript with Just HTML by scrame on Saturday December 27, 2025 @11:14PM (#46408375)
like what?
Re:Replacing JavaScript with Just HTML by iammrpayments on Saturday December 27, 2025 @11:57PM (#46408595)
Tabs, accordion, combobox. There is a whole lot more, these are just the ones I can remember now.
Re:Replacing JavaScript with Just HTML by paulhebert on Sunday December 28, 2025 @12:49AM (#46408794)
Yeah this is true at this point. A lot of more complex patterns require JS to be accessible to screen readers.

We still should do more with HTML and CSS! And reach for leaner solutions than React everywhere.

But be careful going for a pure CSS solution for things like tabs if you don’t understand the accessibility requirements.

(I wish the HTML spec would move faster on these common patterns!)

Re:Replacing JavaScript with Just HTML by wvenable on Sunday December 28, 2025 @03:42AM (#46409485)
> We still should do more with HTML and CSS! And reach for leaner solutions than React everywhere.

It's pretty difficult for anyone to completely understand all the nuances in HTML and CSS. It's a big mess that gets bigger and messier every year.

We should have just given JavaScript even more power over controlling the viewport and leave HTML and CSS for the history books.

Re:Replacing JavaScript with Just HTML by paulhebert on Sunday December 28, 2025 @07:58PM (#46416177)
Because JS isn’t a big mess?
Re:Replacing JavaScript with Just HTML by wvenable on Sunday December 28, 2025 @08:52PM (#46416550)
Yes. But first lets reduce the mess from 3 big mess technologies to 1 and then we can working on replacing JS.
Re:Replacing JavaScript with Just HTML by rhdunn on Sunday December 28, 2025 @02:17AM (#46409135)
https://www.w3.org/WAI/ARIA/apg/patterns/ is my go to for accessibility requirements of components.

And yes, being able to do all of these in pure HTML/CSS would be awesome. Though we are getting there with things like `details` and the newer `popover` features which should make things like rich tooltips, menu buttons, etc. a lot easier to implement. IIRC, there are also several anchor CSS properties to make positioning a lot simpler.

Re:Replacing JavaScript with Just HTML by zepolen on Sunday December 28, 2025 @01:34AM (#46408965)
All of those can be done with pure html/css, eg. https://codepen.io/mikestreety/pen/yVNNNm
Re:Replacing JavaScript with Just HTML by atomicfiredoll on Sunday December 28, 2025 @02:54AM (#46409295)
If we've concluded that's it's okay to have elements that change/morph, as we seem to with the introduction of things like details, a native tab-like element feels like a glaring omission. Tabs have been a long-standing UI pattern and forcing every site to implement their own is a nightmare for accessibility. (The page you're reading is maybe already in a browser tab.)

I wouldn't be surprised if it turned out less than half of the custom tab interfaces on the web failed from an accessibility standpoint. When considering ARIA guidance, I don't even think it's possible to build an accessible version in HTML alone.

Other people have recognized it's missing. Open UI has a draft spec for it[0] and CSS Tricks has an article from 2001 about Open UI's experiments with sections for tabs[1]. I have no idea what happened on this front, though.

[0] https://open-ui.org/components/tabs/

[1] https://css-tricks.com/newsletter/281-tabs-and-spicy-drama/

Re:Replacing JavaScript with Just HTML by auxiliarymoose on Sunday December 28, 2025 @03:52AM (#46409526)
Accordion behavior is discussed in the article in the "Accordions / Expanding Content Panels" section:

> Use the same name attribute on all related details (like radio buttons) to restrict only one open panel at a time

And tabs can be a <details>-based accordion with some creative CSS to adjust the layout (left as an exercise for the reader, but I could write up an example if that would be helpful!)

Re:Replacing JavaScript with Just HTML by iammrpayments on Sunday December 28, 2025 @05:22AM (#46410013)
It won’t have the necessary keyboard shortcuts.
Re:Replacing JavaScript with Just HTML by extra88 on Sunday December 28, 2025 @05:20PM (#46415099)
Yes, the tabs in a tabs pattern should be keyboard navigated using arrow keys (ironically not the Tab key).

Also, the summary for the currently open details element will have the wrong state, 'expanded' instead of 'selected'. And while a set of details can now have a maximum of one open at a time, you can't ensure exactly one is always open (without JavaScript) as the tabs pattern requires.

Re:Replacing JavaScript with Just HTML by rebane2001 on Monday December 29, 2025 @08:29AM (#46420513)
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 by scrame on Friday January 02, 2026 @11:52AM (#46466678)
this article is quite good. Thanks!
Re:Replacing JavaScript with Just HTML by scrame on Friday January 02, 2026 @11:47AM (#46466617)
thanks. I was honestly asking, because I'm trying to catch up on CSS progress and am kind of surprised at stuff it can do now.