Hacker News new | ask | show | jobs
by Dalewyn 489 days ago
The ideal amount of JavaScript is zero.
5 comments

I disagree. The gov.uk website completely eschews JavaScript at some usability cost, in particular form validation is delayed until way later than it would be if they added just a little JavaScript. It can be quite annoying.
> The gov.uk website completely eschews JavaScript at some usability cost

I would imagine this was mostly driven by accessibility requirements more so than some ideological rigidity.

Unfortunately, some people view accessibility as an ideology.
Perhaps, but, taking the example provided, Gov.uk deals with population scale products funded by taxpayers and which may be exclusively digital. Accessibility as an ideology makes sense in this context, and, I would argue, is morally correct.
It’s easy to dismiss the genuine needs of someone else if one’s not impacted though.

Ideology or not, exclusion does not help.

a little bit of the right kind of JavaScript helps accessibility, so it's clearly not
I agree, but HTML widgets are not sophisticated enough not to require some amount of scripting for interactivity in many cases.
I agree and with small single page sites doable but when I need to put a navigation (plus language versions etc) of the site into a mobile layout I have to do the js toggle, or do I?
Why would you need JS for any of that?
how else can I have a fullscreen overlay navigation on a phone from an accessible toggle button?

almost forgot to answer the question: because I don't know any better

One (unusual) approach I like because of the simplicity is to put all your navigation links in your footer, and the hamburger/menu button in the header is just an anchor link that scrolls down to your footer.

Unfortunately, accessible HTML solutions for well established UI patterns like menus and tooltips are still far too difficult to get right (anything that requires JavaScript usually).

Nice, and I agree - maybe… the desktop version gets a nav and on the phone it’s all one elder scroll. With section links if it gets too long. … but still need the entry point for lang versions
Actual answer: like this! https://codepen.io/Sfate/pen/kGbLzK
yep that works thank you - so to get the fullscreen overlay (since we only want it on the phones) a media query - maybe it should be the one gridcell navpage. But maybe the links should be listed for the robots ... if mobile is default/first there would be only one link - yeah maybe this is good.
You can do a lot with CSS these days: https://css-tricks.com/the-checkbox-hack/
It is for documents but we have web apps that are not documents.
Why?