frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Replacing JavaScript with Just HTML

https://www.htmhell.dev/adventcalendar/2025/27/
133•soheilpro•2h ago

Comments

theandrewbailey•2h ago
> Input with Autofilter Suggestions Dropdown

It's great until you have a typo in the field, or want to show options that don't start with what you typed in but appear near the end of an option (think Google search's autocomplete). There's no way to filter in Javascript and force it to show certain options with <datalist>. I've resorted to <ol> for search suggestions.

prisenco•2h ago
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.

willparks•1h ago
It’s great to see practical examples that push us to consider what the platform already offers before adding more layers of complexity.
zdragnar•1h ago
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 the native date pickers.

smlavine•2h ago
The Pentagram at the top of the page does not load without JS enabled.
bitbasher•2h ago
So it's.. fitting, how meta.
superkuh•1h ago
Some of these new HTML features don't fully work in my "ancient" browser. But all of them partially work (ie opening the accordion element doesn't close others but it still opens and closes) and they still remain functional elements I can read and interact with. This puts them far ahead of any javascript implementation which almost universally fail to nothing.
ravenstine•1h ago
What "ancient" browser are you using?
vpShane•1h ago
Probably something 300 CVEs ago.
subdavis•1h ago
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.

webstrand•1h ago
Details works even when it's set display:contents too, for even more flexibility. Can't animate from open›close, yet, though. That's pretty much my last frustration with it.
shakna•1h ago
I think the CSS support for that has finally landed, though it means targetting a pseudo element instead. Its been a year, so support is probably good enough you don't care if just the animation doesn't happen.

https://developer.chrome.com/blog/styling-details

raybb•44m ago
Do they work well for when you want to preview text? Like show the first 100 characters of a paragraph and then click to expand?
veqq•21m ago
Of course. That's the summary part
zahlman•7m ago
Yes. For example, on Codidact (https://codidact.com), limited HTML access is offered along with Markdown when making posts, and the details and summary tags in particular are whitelisted. I've made extensive use of this in some of my content, for example https://software.codidact.com/posts/289251/289252#answer-289... . If you have NoScript you can easily verify that the expanding sections work perfectly well without JavaScript. They can even be nested, as they are here; and the summary text can contain some other forms of markup without issue. (When crafting the post, however, I had to do some tricky things with whitespace to avoid confusing the Markdown parser.)
crooked-v•33m ago
You can't actually control the open state properly from markup (the `open` attribute only sets the default state), which is why I haven't bothered with them.
subdavis•24m ago
Out of curiosity, why have you needed to? This has never come up for me.
bikeshaving•23m ago
I’m not sure this is correct. The DOM class HTMLDetailsElement has the `open` property, which you can use to read/write the details element’s state. If you’re using setAttribute/getAttribute just switch to the property.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetails...

only-one1701•1h ago
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 to get excellent performance. So why don't most people do it?

suprjami•1h ago
Gimme a dark/light mode switch. CSS is allowed.
johnisgood•1h ago
Checkbox and :checked are your friends.
adzm•1h ago
Use a checkbox, d. Define vars for light mode. Override when checked for dark mode with body:has(#d:checked) and can include the dark mode media query too
ronbenton•1h ago
One thing I am quite hopeful for is customizable selects! It's in WHATWG stage 3 right now. I have seen so many horrors with javascript-based custom dropdowns components. https://developer.chrome.com/blog/a-customizable-select
odie5533•1h ago
The Popover API looks really cool. Could see it for tooltips or lightboxes.
cantalopes•1h ago
The problem is that it's difficukt to style or animate those things. Unless you're builsing something for dun or technical where it's not important it's fine but i doubt any real world commercial project would be satisfied with just this
overflowy•1h ago
HTML and JavaScript serve distinct purposes, making better or worse comparisons logically flawed. Complex/interactive web apps requires JavaScript, period. Attempting to build sophisticated apps solely through HTML (looking at you HTMLX) eventually hits a functional ceiling.
mcny•46m ago
It shouldn't have to be this way though. There is no reason html can't do things it needs to do to build complete apps. We could use reasonable defaults to allow a new type of html markup without JavaScript.

All the http verbs. Decent html input controls What else?

imbusy111•45m ago
I assume you mean htmx. It doesn't have to be either/or. You can supplement htmx with Javascript.

The core idea with htmx is that you transfer hypertext with controls and structure built in, not just a JSON blob that requires additional context to be useful.

I have just shipped a very useful and interactive app surprisingly quickly for my customer using just htmx with a little Javascript.

dpedu•49m ago
I didn't know about <datalist>, but how are you supposed to use it with a non-trivial amount of items in the list? I don't see how this can be a replacement for javascript/XHR based autocomplete.
reed1234•46m ago
> If we can hand-off any JS functionality to native HTML or CSS, then users can download less stuff, and the remaining JS can pay attention to more important tasks that HTML and CSS can't handle (yet).
psnehanshu•46m ago
You can't. It's only supposed to be used for a limited list.
econ•42m ago
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 <p> 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 fields. Inventing a completely different method for something very similar is a dumb idea. The old checkbox hack is more flexible and less ugly for some implementations.

Why force the hidden content to be below or above the toggle? We aren't gaining anything with this.

What is this nonsense for an element to not just be hidden or displayed but to have some weird 3rd state where only one of its children is shown?

How should styling it even work for this new state? If I apply a style to the hidden content it must also apply to the link? The text is hidden but the style is visible??? Preposterous!

Don't try style <details> to avoid unexpected behavior. Try wrapping the hidden content in a new element to make it behave normally.

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

The default styling gives no clue about it being clickable?

The pointer (awkwardly called the cursor) choice is the text selection?????

Blue underlined "more" is what everyone does and everyone is used to. The cursor should be pointer. (This is css speak for "the pointer should be a hand")

The number of js toggles you can find online where the button lives inside the hidden text is guaranteed to be zero. Forget about drop in replacement, you will have to reinvent your css.

Maybe I'm dense but I also want my url to reflect the state of the page. I would have been impressed if that was supported. Personally I use actual links and disable default action in the listener if js is enabled/working or modify the state on the server if js isn't available/working.

It would have been great if the toggle action was implemented as a simple attribute something like toggle="element name" so that anything can be clickable and anything can be toggleable. Have a "closed" as well as an "open" attribute for the target.

Doesn't seem very hard. An open/closed attribute would be useful for other things too. Using display:none is terrible as display: is used for many things.

anidsiam•40m ago
Your blogs have very small amount solution, but the JS use cases are very large. How this little replacement can do more thing? I usually like the idea of being using as lean as possible, if it's can be possible to do more thing just with HTML and CSS that's obviously cool. Is it really possible to replace JS with HTML in near future?

BTW the toggle solution (expanding content) is good.

montroser•36m ago
Most of this is great, except for the input/datalist bits, which are not sufficiently functional to be used in any real scenario. Users expect these interfaces to be tolerant of misspellings, optional sub text under each option, mobile ux niceties, etc -- and so everyone builds this with js...
kmoser•27m ago
My main beef with datalist is that there's no easy way to show and allow only text (e.g. Beverly Hills), but have the actual value selected be a number (e.g. 90210). In other words there's no analogy to <option value="90210">Beverly Hills</option>.
65•8m ago
It feels like some variation of this post gets submitted here every week.

Replacing JavaScript with Just HTML

https://www.htmhell.dev/adventcalendar/2025/27/
137•soheilpro•2h ago•37 comments

Fathers’ choices may be packaged and passed down in sperm RNA

https://www.quantamagazine.org/how-dads-fitness-may-be-packaged-and-passed-down-in-sperm-rna-2025...
61•vismit2000•2h ago•17 comments

How we lost communication to entertainment

https://ploum.net/2025-12-15-communication-entertainment.html
317•8organicbits•7h ago•164 comments

Functional programming and reliability: ADTs, safety, critical infrastructure

https://blog.rastrian.dev/post/why-reliability-demands-functional-programming-adts-safety-and-cri...
66•rastrian•3h ago•31 comments

Floor796

https://floor796.com/
603•krtkush•14h ago•76 comments

2025 was the year Xbox died

https://www.engadget.com/gaming/xbox/2025-was-the-year-xbox-died-130000467.html
41•speckx•4d ago•19 comments

Text rendering hates you (2019)

https://faultlore.com/blah/text-hates-you/
101•andsoitis•6d ago•36 comments

Project Vend: Phase Two

https://www.anthropic.com/research/project-vend-2
76•kubami•5d ago•26 comments

Gpg.fail

https://gpg.fail
295•todsacerdoti•10h ago•156 comments

Rainbow Six Siege hacked as players get billions of credits and random bans

https://www.shanethegamer.com/esports-news/rainbow-six-siege-hacked-global-server-outage/
118•erhuve•8h ago•34 comments

Windows 2 for the Apricot PC/Xi

https://www.ninakalinina.com/notes/win2apri/
105•todsacerdoti•9h ago•24 comments

Immer – A library of persistent and immutable data structures written in C++

https://github.com/arximboldi/immer
32•smartmic•6d ago•6 comments

Nvidia's $20B antitrust loophole

https://ossa-ma.github.io/blog/groq
371•ossa-ma•10h ago•122 comments

Clock synchronization is a nightmare

https://arpitbhayani.me/blogs/clock-sync-nightmare/
142•grep_it•4d ago•91 comments

Show HN: Ez FFmpeg – Video editing in plain English

http://npmjs.com/package/ezff
346•josharsh•19h ago•169 comments

Janet Jackson had the power to crash laptop computers (2022)

https://devblogs.microsoft.com/oldnewthing/20220816-00/?p=106994
241•montalbano•10h ago•97 comments

7- and 14-segment fonts "DSEG"

https://www.keshikan.net/fonts.html
18•anigbrowl•4h ago•2 comments

Liberating Bluetooth on the ESP32

https://exquisite.tube/w/mEzF442Q4hUXnhQ8HmfZuq
19•todsacerdoti•5h ago•0 comments

Toll roads are spreading in America

https://www.economist.com/united-states/2025/12/18/toll-roads-are-spreading-in-america
147•smurda•9h ago•412 comments

OrangePi 6 Plus Review

https://boilingsteam.com/orange-pi-6-plus-review/
143•ekianjo•14h ago•126 comments

The Dangers of SSL Certificates

https://surfingcomplexity.blog/2025/12/27/the-dangers-of-ssl-certificates/
30•azhenley•5h ago•46 comments

Ask HN: Resources to get better at outbound sales?

167•sieep•6d ago•40 comments

Say No to Palantir in the NHS

https://notopalantir.goodlawproject.org/email-to-target/stop-palantir-in-the-nhs/
115•_____k•6h ago•16 comments

Pfizer ended up passing on my GLP-1 work back in the early '90s (2024)

https://www.statnews.com/2024/09/09/glp-1-history-pfizer-john-baxter-jeffrey-flier-calbio-metabio/
75•rajlego•6h ago•31 comments

Mruby: Ruby for Embedded Systems

https://github.com/mruby/mruby
129•nateb2022•5d ago•32 comments

Show HN: Mysti – Claude, Codex, and Gemini debate your code, then synthesize

https://github.com/DeepMyst/Mysti
177•bahaAbunojaim•4d ago•142 comments

Richard Stallman at the First Hackers Conference in 1984 [video]

https://www.youtube.com/watch?v=Hf2pfzzWPYE
109•schmuckonwheels•6h ago•18 comments

Exe.dev

https://exe.dev/
418•achairapart•1d ago•273 comments

Splice a Fibre

https://react-networks-lib.rackout.net/fibre
90•matt-p•15h ago•41 comments

Show HN: Viral Potential Predictor

https://hn-ph.vercel.app
30•salebanolow•2h ago•16 comments