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…
Replacing JavaScript with Just HTML
101–110 of 296 posts
Re: Replacing JavaScript with Just HTML
#102Earlier quoted context omitted.
Tabs, accordion, combobox. There is a whole lot more, these are just the ones I can remember now.
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!)
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
#103Earlier quoted context omitted.
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…
I can't see how a bunch of esoteric incantations are better than just some straight-forward easy to understand and follow JavaScript.
Re: Replacing JavaScript with Just HTML
#104Earlier quoted context omitted.
like what?
Tabs, accordion, combobox. There is a whole lot more, these are just the ones I can remember now.
> 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 -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
#105I didn't know about , 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.
Re: Replacing JavaScript with Just HTML
#106Plain HTML is very cozy to me - I came of age in that era. Marquee tags 4eva . But as much as I hate to admit it, it is very difficult to build something functional today with plain HTML and no/minimal JS. If you want, say, a model form that manages its children as well, you're basically going to end up with a 2003-era ASP-feeling application with way too many views and forms (as seen on your employer's current HR sy…
> But as much as I hate to admit it, it is very difficult to build something functional today with plain HTML and no/minimal JS. I would certainly agree that using a little JS can get you further than just HTML. But I think that a plain HTML page is far more pleasant to use (and thus, functional) than the JS monstrosities that dominate the Web today. There's a reason people use the NoScript addon: because a whole lot…
To be snarky, do they? The average user doesn't even know what JS is.
Users want websites that are fast and solve their problems, with a good UI. They don't care how it's made.
Make websites that people enjoy using. A good developer can do that with any set of tools, though a no-JS approach is limited in scope.
Re: Replacing JavaScript with Just HTML
#107Gimme a dark/light mode switch. CSS is allowed.
Why would you build a switch instead of relying on the user’s system settings? The only reason I can imagine is that your dark/light mode is not usable/readable so it forces the user to switch
Re: Replacing JavaScript with Just HTML
#108The 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.
Re: Replacing JavaScript with Just HTML
#109I ran into this repeatedly while writing my book "You Don’t Need JavaScript"[0]: most JS in these cases isn’t adding capability, it’s compensating for forgotten platform features.
Re: Replacing JavaScript with Just HTML
#110Most 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...