Does JS have a future, JavaScript reinventing the wheel or the light?

My using JavaScript for my site has received backlash on every side… hence my question is, what significant thing is in JavaScript and if otherwise what makes JavaScript important at all when it’s only duplicating other technologies?

My best regards
vfbennyme

JavaScript can add a lot of nice features to a website, but you just have to make sure that the website is fully functional without the JavaScript first. Then use JavaScript to enhance the user’s experience.

5 Likes

It is not JavaScript itself which is a problem, but the way it is sometimes used. Increasing numbers of sites rely on it for everything, displaying a blank page - possibly with a “loading” icon - and nothing more for those without JS. If you think that’s not much of a problem, then see this:

https://kryogenix.org/code/browser/everyonehasjs.html

The overuse or misuse of JS for “effects” can cause serious accessibility issues.

Used considerately and appropriately, it’s fine.

4 Likes

My using JavaScript for my site has received backlash on every side

Don’t worry about it. You can not do modern development without JavaScript. You couldn’t even read this reply on this forum without it.

You shouldn’t even need to take Disabled JS into consideration. A couple years ago, I would have been apprehensive about saying this, but now in 2017 I have no problem saying it with 100% certainty. Even worrying about people with it disabled will only effect your app negatively.

The battle is over. JS has won.

but you just have to make sure that the website is fully functional without the JavaScript first. Then use JavaScript to enhance the user’s experience.

@WebMachine

There’s really no reason to do this anymore. Search engines execute JS just like browsers do. Progressive enhancement in this sense, is nothing more than a relic of the past. You should spend the extra effort ensuring that your page/app is semantically correct and meets accessibility standards.

“Progressive enhancement” now has more to do with rendering speed and perceived performance. The user needs to get something painted on their screen and be able to interact with the content as quickly as possible. But it can take a lot of work, and if you’re page loads relatively fast then it’s probably not worth worrying too much about.

6 Likes

To a large extent I think that is the de facto reality, but as I posted in vfbennyme’s review topic, I’m not so sure I’d be willing to take that risk yet. Perhaps I’m biased from having lived through the “can I stop designing for 800 pixels yet” and “can I drop support for IE6 yet” days.

Review my new site - #25 by Mittineague

2 Likes

Perhaps the one thing to remember—and why progressive enhancement still has a place—is that you can’t rely on JS to work always. There are many situations in which is might not load properly (it happens on my network all the time, for some reason), and at those time it sure is a problem if the content and/or functionality relies solely on JS.

Edit: Actually, TechnoBear’s link explains this situation really well.

4 Likes

There are many situations in which is might not load properly (it happens on my network all the time, for some reason), and at those time it sure is a problem if the content and/or functionality relies solely on JS.

Then the page should be refreshed. Same thing if the CSS fails to load.

This problem is actually considerably reduced if the entire frontend is rendered from JS, as it is here on Discourse forums. It only has 1 chance to fail, because once it’s loaded you don’t have to reload it again.

2 Likes

Your use of JavaScript and whether you provide some sort of fallback greatly depends on your use case. I think it’s important to make the distinction between the web as a content platform and the web as an application platform. Traditional, content-based sites like SitePoint and Wikipedia can often provide the majority of their functionality through HTML and CSS alone - in this situation using JavaScript to progressively enhance the pages is viable, because at the end of the day it’s often just adding ‘nice to have’ rather than essential functionality.

When you start talking about web applications, the situation changes, and JavaScript is used to provide functionality that just couldn’t be implemented in HTML and CSS alone. I think sometimes people make the mistake of trying to apply the rules from web content to web applications, but even though they both use the same underlying technologies, they are fundamentally different use-cases and the old rules don’t always make sense.

So to answer your question, “what makes JavaScript important at all when it’s only duplicating other technologies?”, even though it can duplicate the work of other technologies (and there can be benefits to doing so), JavaScript is important for the things it allows us to do that can’t be done with plain old HTML and CSS. Online applications like photo editors, spreadsheets and audio mixers would be impossible without it.

13 Likes

I agree with @fretburner’s point that there is a distinction between websites and web apps. I have no problem with the use of JavaScript where it’s appropriate, and where its use doesn’t reduce or remove the ability of some visitors to use the site. Unfortunately, it seems to have become so common that some sites use it “because they can”, rather than because it’s needed, or implement it badly, and these are the sites I have a problem with.

Sliders/carousels and other animated images are widely prevalent, but very few sites seem to implement the recommendations for moving images:

Animation should almost always be user controlled or very short in duration. Images that continually animate can cause the rest of the page to be more difficult, or for users with very high levels of distractibility, totally inaccessible.

WCAG 2.0 Success Criterion 2.2.2 (Level A) requires that automatically moving, blinking, or scrolling content that lasts longer than 5 seconds can be paused, stopped, or hidden by the user.

http://webaim.org/techniques/images/

Multiple moving elements in view at once can render a page unusable.

Likewise, shrunken “hamburger” menus which expand when clicked have become popular and common. Sadly, too many sites either don’t know or don’t care about making their JS keyboard-accessible, rendering these menus inaccessible for anybody navigating by keyboard - which includes most (if not all) screen reader users. (An example of that, unfortunately, is on the sitepoint.com main site.) Other JS-powered links often suffer similar problems.

So by all means use JS on your sites - but please do it carefully so you don’t exclude sections of your potential visitors.

See http://webaim.org/techniques/javascript/ for more information.

3 Likes

Most animations are done with CSS, now.

Accessibility is different and something everyone should be concerned with. It’s not really even related to this topic, other than that’s where you should be putting your extra effort instead of worrying about disabled JS.

While I agree with you, on the issue of accessibility how can one drive from San Francisco to New York without road map? and if disabling JS does not help accessibility without providing a fallback then JS is accessibility ENEMY

Not so. Poorly implemented JavaScript causes accessibility problems - but so does badly-designed or ill-thought-out HTML/CSS. That’s why there are guidelines for accessibility (in all areas; not just JS).

A web page containing JavaScript will typically be fully accessible if the functionality of the script is device independent (does not require only a mouse or only a keyboard) and the information (content) is available to assistive technologies. Unfortunately, there is no easy fix that can be applied to solve all accessibility problems associated with JavaScript. The only way to ensure JavaScript accessibility is by evaluating each pages that utilizes scripting and devising a unique solution to any accessibility problem found.

http://webaim.org/techniques/javascript/

2 Likes

if disabling JS does not help accessibility without providing a fallback then JS is accessibility ENEMY

Disabling JS is not an actual physical disability.

Accessibility pertains to disabled persons who need assistance operating a computer, through various non-traditional mans. The tools they use need to be able to understand the page in a logical way to present it to the user. So in a sense, building for accessibility is simply building things in such a way and by following semantics so that a computer can make sense of your page, so it can in turn help the disabled user make sense of the page.

The most common tool people use are screenreaders for the blind. The screen readers need to be able to tell the user what things are on the screen, it needs to be able to find them, and it needs to let the user navigate with a keyboard in a natural way.

There are other factors that play into it as well. For example, keeping colorblindness in mind in your designs and don’t communicate strictly by using colors, is also part of accessibility.

1 Like

Backlash for using Javascript on your site? Are you writing from 1998? JS is the web language. It’s quite easy to add a fallback text page. But worrying that one of your visitors might have no eyes or arms, or that your visitor is on a train with a 300 baud connection entering a tunnel, or that your visitor works at the Lemony Snicket Corporation that has a strict policy to use ONLY the Netscape Navigator or a Lynx text-only browser, seems to be rather silly in 2017.

1 Like

So you don’t care at all for accessibility?

Last I heard it was still HTML. :shifty:

3 Likes

This discussion stems from a real person reporting a real issue with a site the OP asked to have reviewed. So not a hypothetical discussion about hypothetical visitors, but genuine experience.

Personally, when I’ve gone to the trouble of building a site, I want to ensure it attracts the widest possible potential audience, and I prefer not to put obstacles in their way. By all means, use JS, but don’t let your use of it exclude some people from your site.

2 Likes

Last I heard it was still HTML

HTML is simply the structure. You’re not going to create a modern experience with only HTML. There very little reason to touch HTML without passing through some sort of template language and fat clients dominate the professional world. JS is the web language (right now).

1 Like

Suppose you tell us the different ways you are using JS so we can advise you better. Right now, all the replies are general and I don’t know which, if any, apply to your case.

Kindly refer the follwing links: Review my new site - #10 by vfbennyme Review my new site - #21 by Erik_J @StevenHu

For me, ensuring that a site is “usable” (albeit, even if a less than ideal user experience) is important.
For example, if there were a lot of content sections, I would first make sure they all displayed even if the page was very long and required a visitor to scroll a lot to read everything. Then I would add CSS or JavaScript to have the content display in a collapsible accordion.
Similarly, I would ensure that navigation links displayed even if they took up a lot of screen real estate, then add CSS or JavaScript to display the navigation links in a smaller expandable menu.

That is, I would not rely on using CSS or JavaScript in a way that if for whatever reason a browser did not use them the site did not display content or navigation. I would use CSS and JavaScript to make the user experience better for browsers that did use them.

For me, this means “progressive enhancement” starting with the HTML so that all text content is there and all navigation is available regardless of how “ugly” it might be - then making it better by adding CSS, images, and JavaScript.

This is only my opinion of how I think it should be. Other opinions are valid depending on circumstances.
It might be that the site is targeted to visitors where working CSS, images and JavaScript is integral to the sites use.
It might be that the site has considered the cost and decided that the risk of alienating some visitors is acceptable.

2 Likes