views:

66

answers:

5

Ok this is a bit of a rant and a question combined - Why the hell is magento so reliant on javascript?? This goes agaisnt all usability guidelines. WHats so annoying is that it even uses buttons instead of correct form submit elements. Why? This makes no sense what sense at all to me.

Why is this and is there a way around it?

+1  A: 

I think you'll find that the Javascript in most cases significantly enhances the usability. Trying to implement something like the Manage Products grid, Manage Categories tree or Promotions editor without Javascript would be a usability nightmare. When you look at the stats, well over 95% of browsers have Javascript enabled, so what's the problem?

Jonathan Day
I think David meant accessibility.
Alan Storm
Perhaps he did, but that just reinforces my suggestion re proof-reading. You'd better make sure that you have your house in good order before you go throwing mud. Particularly when a little bit of research and investigation makes it very clear that the Magento investment in Javascript is hardly due to recalcitrance as the OP implies...
Jonathan Day
+2  A: 

Magento's JS reliance is unusable in exactly one way: you cannot use the store without it. That's a big one (losing 1/20 of your customers is not a small thing), but ultimately it's a tradeoff that they decided was worth it.

As an example of the flexibility that you get as a result of this decision, consider the case of configurable products, especially with pricing differences. Magento allows you to create products that are configurable over N axes, in a ragged manner (some color/size combinations of clothing can be missing, for example), with different pricing for every single option. Doing that without JS would be tough, doing it elegantly (which Magento has, for the most part), is nigh impossible. By enforcing JS, the developers at Magento, Inc can spend their time implementing these kinds of features more quickly, which is to everyone's benefit.

To answer the question at the end of your post, no you cannot get by without it -- at least without writing a new frontend theme that reimplements everything from scratch, which nobody so far seems to have been able to do. Personally, the number of JS libraries that Magento uses seems pretty heinous to me, but nobody seems to have solved that problem either. The app is too complex and tightly woven to unwind that far.

Sorry it's not better news, but I hope that at least clarifies some of the thinking for the way things are.

Thanks, Joe

Joseph Mastey
FYI: Varien is no more, they're now Magento Inc.
Alan Storm
Varien is dead, long live Magento Inc?
Joseph Mastey
+2  A: 

The past five years have seen an increase of web application developers eschewing the common wisdom of of the late 20th and early 21st century by creating applications and require javascript as a baseline technology. Magento is following this trend because they want to provide a moden, AJAX enabled experience, and providing both a Javascript and non-Javascript experience increases both development and testing time.

Most decisions in the e-commerce industry come down to the ROI of increased sales. Magento has calculated/bet/decided that sales lost due to people having Javascript off are less than the cost of developing both a javascript and non-javascript experience.

As for their use of the HTML button attribute, Magento isn't a web page, it's a web application. Their architecture takes a Java like approach, including a UI that's abstracted away from the browser. This means PHP is used to tame the browser rather than using PHP to work with the browser. In this context button elements (driven by Javascript) make more sense. Take a look at Google Web Tools for another example of this.

The way to "get around" this is to not use Magento, or to customize Magento such that it fits your model of what web development should be. If your first response to this is "woah, that would take way too much time", then congratulations, you're thinking exactly the same way that Magento is. Magento, the company, isn't Microsoft, or Oracle, or SAP. They're a 200 person company, and expecting them to solve all your problems (for free) isn't realistic.

Welcome to 2010.

Alan Storm
Nice closing paragraph. It makes me laugh when I see people suggesting that Magento really should "just replace Prototype with jQuery". Sure, I'll just get onto that in my lunchbreak. Seriously people, this is a powerful and enterprise-scope web application (as you point out), not some backyarder's hacked-together script. There are literally tens of thousands of Architect and Developer hours gone into this thing. </rant>
Jonathan Day
Whilst we're ranting on script libraries I for one am really glad of Prototype instead of anything else. jQuery is popular because it's simple, it makes common tasks that much easier, but it essentially reduces Javascript to a procedural language. Prototype is closer to OOP and that benefits the more complex nature of Magento. Inheritance allows larger teams of developers to work simultaneously on a project. Now what REALLY annoys me is devs choosing to add jQuery to a theme...
clockworkgeek
Amen @clockworkgeek and, in many cases, adding jQuery is due to laziness. There are very few effects or libraries in jQuery that don't already exist or couldn't be easily created in Prototype. All of which just adds to Magento bloat.
Jonathan Day
@Alan - yes, from the point of view of the store owner who works in the back-end, Magento is in fact a web application as opposed to a web site. I completely understand this and have to really congratulate Magento on how well this works. My issues though are with regards to the front end, and I don’t think you can argue that from the point of view of a customer browsing the site, that Magento is a web application. In this sense it is definitely a web site and it should follow accessibility and web standards. Surely you must agree.
David
@David your heart seems in the right place, but you're going to find that outside a certain niche of interactive/agency developers (who do great work), the rest of the software industry is filled with people who have to make compromises each and every day. Accessibility and standards are hard to quantify for a fast moving company, and are often the first to go. If you're interested in helping Magento solve that problem, anonymously guilt mongering on a forum isn't the best way to achieve that goal.
Alan Storm
A: 

Try using this site with java-script disabled. It works but start counting the post backs and you will see why usability trumps the few folks who insist on disabling java-script.

+1  A: 

"Why is this and is there a way around it?"

Although the front end uses Javascript heavily it is only essential in a couple of places. Configurable products is one. The one-page checkout is another but that at least can be disabled in System > Configuration > Checkout > Checkout Options.

Buttons with event handlers can be rewritten as a matter of theming, in some cases their destination URL is not the same as their form submission so a little forethought is required. In some cases buttons are not in the form element they are submitting, that is why they use script.

I will assume when considering accessibility you are not concerned about luxuries like image zoom and search suggestions. I notice HTML5 provides the datalist element for input suggestions but some sort of script would still be needed to update it beyond the initial suggestion.

Overall Magento is quite functional without Javascript, just not as out-of-the-box. An 'accessible' theme would make a valid extension should someone want to develop it.

clockworkgeek