caniuse.rs icon indicating copy to clipboard operation
caniuse.rs copied to clipboard

Make website accessible without JavaScript

Open not-my-profile opened this issue 2 years ago • 3 comments

Currently https://caniuse.rs/ requires both JavaScript and WebAssembly. If you lack one of those you just get a blank page.

I think we can make the site more accessible as well as greatly simplify its build process:

  • main.rs would just generate a bunch of static .html files along with a single .json file containing all feature data (which by the way is also what caniuse.com is doing)
  • there would be some small optional JavaScript that enables the client-side search

For the search we could use the same setup that mdBook is using: elasticlunr.js + elasticlunr-rs to have the search index be generated statically. I think the resulting search would be even more performant than the current search (I have a noticable lag when starting to type).

Of course the optional search part could also be implemented in Rust & WASM but I really don't think that there is any good reason for that ... it just significantly increases both the build as well as the runtime dependencies.

not-my-profile avatar Nov 26 '21 17:11 not-my-profile

Yes, this is not the way this would be done in production, but it's what I wanted to do.

I've long been planning to make the site work without JS as well, but never got to it.

We can discuss making the site work much better w/o JS, but I'm not willing to replace Yew for the interactive parts of the site (or doing a full page load for navigation when JS & WASM are available). I don't think there are currently realistic ways of running Yew server-side, otherwise that could be an option too, although you are right that most of the site could be generated statically.

jplatte avatar Nov 26 '21 17:11 jplatte

Right, you can of course use whatever you want.

I implemented the frontend I had in mind at https://rust-features.push-f.com/. It works without JavaScript ... if you want to you can link it in your <noscript> message, e.g:

Your browser needs to support JavaScript and WebAssembly for this site to work. For an alternative site that works without JavaScript see https://rust-features.push-f.com/.

not-my-profile avatar Nov 29 '21 08:11 not-my-profile

along with a single .json file containing all feature data

@not-my-profile Worth mentioning that it's done already: https://caniuse.rs/features.json

robjtede avatar Jan 19 '22 01:01 robjtede