Live data from Hacker News

HTML Can Do That

chrisburnell.com

131–140 of 249 posts

Re: HTML Can Do That

#131
post #20

Related to this, I’d love that HTML natively support sortable tables. This is a common need but every single time I have to reimplement it.

I had always thought that table sorting seems like the perfect job for HTML, given its data-driven nature, and the possibility of implementing sort information into the attributes of table cell elements.

But thinking about it: Is there a precedent for HTML to be able to include information that instructs the device to present the DOM out of order? Maybe it's out of scope for HTML to have information about presentation order, when the order is supposed to be implied strictly by the DOM hierarchy itself.

Of course, CSS can visually reorder stuff (e.g. `order` on flex/grid items), but MDN has accessibility warnings regarding the use of `order` and visually presenting the data in an order not reflected by the DOM. So, maybe sorting is best done by reordering the DOM after all.

Re: HTML Can Do That

#132
HTML did since inception but that didn't stop people from trying to reinvent it using and a bunch of JS.

All these great built in features, especially typeahead, wont be mainstream until they can be excessively styled.

Re: HTML Can Do That

#134
post #132

HTML did since inception but that didn't stop people from trying to reinvent it using and a bunch of JS. All these great built in features, especially typeahead, wont be mainstream until they can be excessively styled.

Isn’t that because select wasn’t style-able?

Re: HTML Can Do That

#135
post #123
post #118

Earlier quoted context omitted.

> Want sortable tables? Get a jquery plugin and spend five minutes, done. I want sortable tables without having to rely on a third-party plugin to a third-party library. HTML describes content, not just layout. It would be a `sortable` attribute on the table, just like you already have attributes that have nothing to do with layout such as `autocomplete` or `aria-*`.

Everyone already complains that browsers are too bloated and now you want to have every browser support sortable tables when a single, simple JS file would work?

>single, simple JS file

It's all fine and dandy until marketing bros decide to shove all kinds of shady modals into that JS file. The JS side is not exclusive to trivial interactivity.

Re: HTML Can Do That

#136
post #123

Earlier quoted context omitted.

Everyone already complains that browsers are too bloated and now you want to have every browser support sortable tables when a single, simple JS file would work?

>single, simple JS file It's all fine and dandy until marketing bros decide to shove all kinds of shady modals into that JS file. The JS side is not exclusive to trivial interactivity.

What "marketing bros?"

It's open source software. You can see what it does, and you just put it on your server. We're talking about pre NPM javascript here, no continuous deployment, everything is vendored and local and no one is going to change that file without your knowledge and permission. And if someone does, you have much bigger problems on your hands.

What you can't own and control is the browser vendors and how they choose to implement things, or not to. You can edit a JS file to your specific needs, but you're stuck with whatever the browser decides.

Re: HTML Can Do That

#137

Popover, dialog, invoker commands, our entire production app uses these everywhere and it works really well! The fact that dialogs and popovers are rendered on the "top layer" and that nested popovers are also automatically stacked on top of each other and have 'cascading close' shows how well these standards were designed. The only hard thing is still to position a popover near the element that triggers it, such as…

> The only hard thing is still to position a popover near the element that triggers it, such as when you want to create a context menu that has to render above/below the button that triggered it.

If you put something like this in your popover class, it will resolve to the button that called it when position-anchor is not set:

top: anchor(bottom);

I'm not sure how widely supported it is but I've been using it in Firefox/Chrome.

Re: HTML Can Do That

#138
post #75

Earlier quoted context omitted.

HTMX is the solution

So instead of using JS to sort the table directly, now you make a JS fetch() request to sort the table?! It does make sense in one situation, if the table is a large server-side paginated one and the sorting is really an ORDER BY clause. But for a basic table that fits entirely on the client, it doesn't make sense at all. There are tiny JS libraries that will make s sortable when you add a particular class name.

> tiny JS libraries that will make s sortable

What are some good ones?

Re: HTML Can Do That

#139
post #41

The only one not mentioned I think should be utilized more is properly names in html forms. Everyone has gotten used to just doing things in javascript when a lot of times if you name the fields in a correct way, you can do a simple form post and let the backend validate it with little to no modifications (hopefully none if you did it correctly). I think the big issue with some of items listed is not all the browsers…

It seems like the future is doing things like we did in 1998 but with HTML and CSS that isn't terrible.

Re: HTML Can Do That

#140
post #90

JS has been in front-line for these functionalty, and HTML has been dog-slow to catch up with slow standardization (not based on usage more academical) and recommendations. HTML can do that. yes. but adoption? welp, I don't really care nor will I use it unless I have to. I will use whatever was available in practice and continue to use them.

Odd to both complain about adoption and out yourself as someone unwilling to move to a better solution because it’s less familiar. What do you expect the answer to be here?

I suspect he's still optimizing for IE5 compatibility.
Post reply on HN