5 ms·
I'd be a little concerned with using this in production, because it would make your menu completely unusable for anyone without JavaScript enabled. As with mos
by StevenWaterman 5y ago
I'd be a little concerned with using this in production, because it would make your menu completely unusable for anyone without JavaScript enabled.
As with most things, the ideal is somewhere in the middle - use these techniques to get a baseline, then embrace progressive enhancement and round off the rough edges with JavaScript
- krapp 5y agoAbout 98% of people have javascript enabled, and most of the rest will unblock your site if they need to use it anyway. The remnant who absolutely refuse to run javascript under any circumstance aren't worth worrying about unless you want to appeal to them, specifically, as a demographic.
- StevenWaterman 5y agoFrom further down the page, this is relevant https://kryogenix.org/code/browser/everyonehasjs.html https://kryogenix.org/code/browser/everyonehasjs.html
- rwalle 5y ago> Sky accidentally block jQuery, Comcast insert ads into your script, and if you've never experienced this before, drive to an airport and use their wifi. Sure, in the year of 2010 maybe... With https on almost every website this is hardly an issue now. We need more valid critism, not these outdated incidents to scare people
- lysecret 5y agoYea i kind of agree also the way I have set up the page it is only an issue in mobile view. I guess the combination of no JS and mobile is even smaller.
- lysecret 5y agoReally good point. I'm more of a backend person. But how would you do it?
- bmacho 5y agoE.g. how they implement CSS-only sidebar, with a custom checkbox: https://lanyon.getpoole.com/ https://lanyon.getpoole.com/ I use this theme, because I disable js myself.
- shrew 5y agoI love no-JS type hacks and solutions as your post has suggested, but I would actually be more concerned about using solutions like your hidden menu in production than what the parent has suggested. Some of them, like the checkbox dark mode, are indeed hacks and cause issues with accessibility, and when I've tried a suitably complex burger menu without JS, I find it a buggy and annoying UX. I think the true progressive enhancement route would be to render the menu either visibly on the page (maybe at the bottom?) or on a separate page entirely. Your burger menu icon is a link (either an anchor to bring the menu into view or to the dedicated menu page) and if JS is supported, you hijack the link using code similar to the parent comment and add a class to bring the menu element into view from there. In doing so, your page can work just as HTML, not even CSS required, and if JS is supported then you have real state management to control the visibility of your menu (although accessibility concerns still potentially exist if you're not careful!).
- lenkite 5y agoIt's unfortunate that you are getting downvoted for a legitimate response. Switching off JS saves power considerably and there are folks disabling JS all the time. They don't get tracked and so are mistakenly considered a super-minority by the JS devout here.
- DocTomoe 5y agoMany people have built a career around JS, and are unhappy when their holy cow is considered a future hamburger. JS has its uses. The majority of UI elements should not involve JS though. Unfortunately, UI also provides low-hanging fruit for beginner-level JS developers to tangle with.