5

For a feature I'm currently working on implementing on my application (a pretty standard feature), it seems like I have to essentially disregard "graceful degradation." I'm referring, of course, to a "linked" country/territory select input. Both supplying the data for and implementing the control of these linked controls depends solely on JavaScript.

Just in case you don't know what I'm talking about, it's having a country select input which, when changed, directly changes the state of a territory select input, either by changing what can be selected or by disabling the territory input altogether when a country has no defined territories.

It seems kind of strange for me that there's no real non-JavaScript solution for this.

Is requiring JavaScript in this instance an ok thing to do? Essentially, it makes it near impossible to use without JavaScript enabled. Should I even care about users with JavaScript turned off in 2011?

3 Answers 3

12

Pragmatically it's when the cost of doing the graceful degradation outweighs the benefit.

So in your case, you really need to know the number of users who have JavaScript turned off. If this is a large proportion of your user base, then you probably have to do something to cater for them. If it's only a small percentage, then you probably don't need to bother.

At the end of the day it's a commercial decision. Can your business cope with the loss?

2
  • 2
    "Pragmatically it's when the cost of doing the graceful degradation outweighs the benefit." Very good point, this is the perfect response to pass back to the stakeholder. Anything is possible, and it's surely possible to get a functioning version of this system without JavaScript, but it'll be costly in both time and money and will probably result in a rather unwieldy UX anyway. Is it worth all that?
    – JonW
    Nov 14, 2011 at 16:14
  • For sure, that makes sense as an approach. I think I'll use @DisgruntledGoat's solution so that I'll still be able to do validation properly. Nov 14, 2011 at 21:21
7

I think you can add a button after the 'country select input', then reload the incomplete form with the selected country territories. When Javascript is enabled, hide the button.

If it's worth worrying about users with Javascript disabled, I think it depends on the kind of thing you're doing, the target, and the time you have to do it. In this case, seems like a relatively simple solution.

2
  • 2
    +1 for a technical solution. Another possibility: depending on how many options there are in the second select field, you could also just list them all (with <optgroup> tags) but filter with JS when the user chooses from the first select field. Nov 14, 2011 at 15:57
  • @DisgruntledGoat Genius. That could actually work. Then, when submitting it in my form, I could validate that the selected territory matches the selected country, or than no territory is selected for a given country with no territories. Nov 14, 2011 at 21:17
6

There's no answer that applies universally. I will say that accommodating non-JS is becoming much less of a priority. From an accessibility standpoint, things like ARIA are helping us move in the right direction allowing JavaScript to be an assumed standard tool.

I usually draw the line at sanity. At a certain point, the amount of time/effort spent on an outmoded browser or platform isn't fair to everyone that has updated to a standard platform. Our time could be spent improving their experience rather than accommodating this minority of people using an outdated tool to access the product.

5
  • 2
    A problem with not supporting JS are the (stubborn and annoying) people who browse with JS disabled. No matter if everyone uses a JS enabled browser there's always a few of those people. Always be sure to display a message when JS is unavailable if it is indeed required for an element.
    – Ben Brocka
    Nov 14, 2011 at 15:15
  • Yes, excellent point. Always inform them if they don't have JS enabled. I personally turn of JS all the time when testing and building sites and sometimes forget to turn it back on then get stumped as to why so many sites are suddenly broken. ;)
    – DA01
    Nov 14, 2011 at 15:20
  • so if (javaScript.isDisabled) alert("You're lame?"); ;) Nov 14, 2011 at 21:15
  • How can I tell if a user has JavaScript disabled? Is there something in the headers or do I just try to perform an operation and if it doesn't work, determine that JavaScript is disabled? Nov 14, 2011 at 21:19
  • 1
    @TKKocheran To detect if javascript is disabled see this on stackoverflow: stackoverflow.com/questions/121203/… Nov 14, 2011 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.