Magento - javascript 依赖 = 巨大的可用性问题

发布于 2024-09-29 20:18:59 字数 130 浏览 7 评论 0原文

好吧,这是一个咆哮和一个问题的结合 - 为什么 magento 如此依赖 javascript?这并不违反所有可用性准则。令人讨厌的是它甚至使用按钮而不是正确的表单提交元素。为什么?这对我来说毫无意义。

这是为什么?有解决方法吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

絕版丫頭 2024-10-06 20:18:59

在过去的五年里,越来越多的 Web 应用程序开发人员避开了 20 世纪末和 21 世纪初的常识,创建应用程序并要求将 javascript 作为基准技术。 Magento 正在追随这一趋势,因为他们希望提供现代的、支持 AJAX 的体验,并且提供 Javascript 和非 Javascript 体验会增加开发和测试时间。

电子商务行业的大多数决策都取决于增加销售额的投资回报率。 Magento 已经计算/打赌/决定,由于人们关闭 Javascript 造成的销售损失低于开发 javascript 和非 javascript 体验的成本。

至于他们对 HTML 按钮属性的使用,Magento 不是一个网页,而是一个 Web 应用程序。他们的架构采用类似 Java 的方法,包括从浏览器中抽象出来的 UI。这意味着 PHP 是用来驯服浏览器的,而不是使用 PHP 与浏览器一起工作。在这种情况下,按钮元素(由 Javascript 驱动)更有意义。看一下 Google Web Tools 的另一个例子。

“解决”这个问题的方法是不使用 Magento,或者自定义 Magento,使其适合您的 Web 开发模型。如果您对此的第一反应是“哇哦,这会花费太多时间”,那么恭喜您,您的想法与 Magento 完全相同。 Magento 公司不是 Microsoft、Oracle 或 SAP。他们是一家拥有 200 名员工的公司,期望他们(免费)解决您的所有问题是不现实的。

欢迎来到 2010 年。

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.

川水往事 2024-10-06 20:18:59

Magento 的 JS 依赖在某种程度上是无法使用的:没有它你就无法使用商店。这是一个很大的问题(失去 1/20 的客户可不是一件小事),但最终这是一个他们认为值得的权衡。

作为此决定带来的灵活性的一个示例,请考虑可配置产品的情况,尤其是具有定价差异的产品。 Magento 允许您以参差不齐的方式创建可在 N 轴上配置的产品(例如,衣服的某些颜色/尺寸组合可能会丢失),并且每个选项都有不同的定价。如果没有 JS,要做到这一点会很困难,而优雅地做到这一点(Magento 大部分都具备)几乎是不可能的。通过强制执行 JS,Magento, Inc 的开发人员可以花时间更快地实现这些功能,这对每个人都有好处。

要回答文章末尾的问题,不,没有它,你就无法生存——至少不编写一个新的前端主题来从头开始重新实现所有内容,到目前为止似乎没有人能够做到这一点。就我个人而言,Magento 使用的 JS 库的数量对我来说似乎相当令人发指,但似乎也没有人解决这个问题。该应用程序太复杂、太紧密,无法展开那么远。

抱歉,这不是更好的消息,但我希望至少澄清了一些对事情现状的思考。

谢谢,

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

清浅ˋ旧时光 2024-10-06 20:18:59

“为什么会这样?有解决办法吗?”

尽管前端大量使用 Javascript,但它只在几个地方是必要的。可配置产品就是其中之一。单页结帐是另一个,但至少可以在“系统”>“系统”中禁用。配置>结帐>>结帐选项。

带有事件处理程序的按钮可以根据主题进行重写,在某些情况下,它们的目标 URL 与表单提交的内容不同,因此需要进行一些深思熟虑。在某些情况下,按钮不在它们提交的表单元素中,这就是它们使用脚本的原因。

我假设在考虑可访问性时,您并不关心图像缩放和搜索建议等奢侈品。我注意到 HTML5 提供了 datalist 元素用于输入建议,但是除了最初的建议之外,仍然需要某种脚本来更新它。

总的来说,Magento 在没有 Javascript 的情况下也能正常工作,只是不是开箱即用的。如果有人想要开发它,“可访问”主题将成为有效的扩展。

"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.

冷心人i 2024-10-06 20:18:59

当我看到这篇文章时,我们刚刚开始研究这个问题(我们第一次使用 magento 平台以及我们的第一个项目)。

通常,我们会确保我们开发的每个网站都可以在没有 JavaScript 的情况下正常降级,但这看起来对我们来说,在这个特定项目上,至少在第一阶段(紧迫的期限和陡峭的学习曲线)可能需要做太多的工作。

虽然我同意 javascript 可以提供一些伟大的可用性增强,但提供非 javascript 后备不仅仅是支持那些坚持关闭它的奇怪的笨拙的人。

据我所知,一些使用禁用访问设备(屏幕阅读器等)的用户可能也无法选择使用 javascript(或者可能会发现 javascript 接口使用起来更麻烦,如果在某些情况下并非不可能的话)。在这些情况下,如果它不能为他们优雅地降级,那么我有点担心它可能与英国/欧盟(我们的客户运营所在地)的残疾歧视立法相冲突。

出于这个原因,我不确定从长远来看我们能否采取 magento 开发人员的立场(我们最终可能会回溯并自己解决这个问题,我猜这将比优雅降级花费我们更长的时间)从一开始我们就可以简单地以此为基础)。

管理区域不是什么问题,但是前端应该可以在没有 javascript 的情况下工作,恕我直言,当我发现没有它就无法工作时,我有点惊讶(客户来找我们指定了 magento,所以我们没有太多的东西)可以做但目前运行它)。

We've just been looking into this when I came across this post (first time we've used the magento platform and our first project with it).

Typically we'd ensure that every site we develop degrades gracefully without javascript, but this is looking like it might be too much work for us on this particular project at least for the first phase (tight deadline alongside steep learning curve).

While I agree that javascript can offer some great usability enhancements, providing a non-javascript fallback isn't just about supporting the odd akward person who insists on turning it off.

Some users using disabled access devices (screen readers etc) as far as I know, might not have the option to use javascript either (or may find javascript interfaces more troublesome to use if not impossible in some cases). In these cases if it doesn't degrade gracefully for them, then I'm a bit concerned that it may conflict with disability discrimination legislation in the UK/EU (where our client operates).

For this reason, I'm not sure we can take the position the magento developers have in the long run (we'll probably end up backtracking and resolving this ourselves ultimately and I'm guessing that will take us longer than if it degraded gracefully from the start and we could simply build upon that).

The admin area is less of an issue, but the front end should work without javascript imho and I was a bit surprised when I discovered that it didn't work without it (the client came to us specifying magento so there isn't much we can do but run with it at the moment).

苄①跕圉湢 2024-10-06 20:18:59

我想您会发现,在大多数情况下,Javascript 显着增强可用性。尝试在不使用 Javascript 的情况下实现诸如“管理产品”网格、“管理类别”树或“促销”编辑器之类的功能将是一场可用性噩梦。当你查看统计数据时,超过 95% 的浏览器都启用了 Javascript,那么问题出在哪里呢?

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?

中性美 2024-10-06 20:18:59

尝试在禁用 java 脚本的情况下使用此网站。它确实有效,但开始计算回帖数,您就会明白为什么可用性胜过少数坚持禁用 java 脚本的人。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文