timwis / jkan

A lightweight, backend-free open data portal, powered by Jekyll
https://jkan.io
MIT License
218 stars 310 forks source link

Use progressive enhancement #237

Closed timwis closed 1 year ago

timwis commented 1 year ago

I've pulled in @dracos' commits from #139 on top of the latest v2 branch, and resolved merge conflicts, but I rewrote the commit that changes datasets.html.

Here's how it works this time. With JavaScript disabled:

With JavaScript enabled, it hides the panels that list all categories and organisations, and populates a separate div. This reduces (but does not eliminate) jitter because the logic to hide it is executed very quickly on page load (swap the no-js class for js in the html element, and CSS takes it from there), whereas the logic to populate and sort the filter panel is done asynchronously after a JSON file is fetched. There still remains a jitter, but it should be exactly the same jitter that you'll already see in JKAN (demo.jkan.io/datasets).

We could go even further and add that plugin to sort it, but I reckon this gets us over the line, and we can always revisit the plugin after the GitHub Actions work is complete. What do you think?

timwis commented 1 year ago

Thanks. And yes, there's a checkbox in devtools settings to disable JavaScript :)