简体   繁体   English

UI中模态对话框的最佳方法

[英]Best Approach to Modal Dialogs in UI

My team is in the process of prototyping an application with a rather complex UI. 我的团队正在使用相当复杂的UI对应用程序进行原型设计。 One common feature of the application is a number of tools which pop up above the main app and allow users to perform some complex operations. 该应用程序的一个常见功能是在主应用程序上方弹出并允许用户执行一些复杂操作的许多工具。

Currently a consultant has wrote some custom code that displays the dialog and blocks the background UI. 当前,一名顾问编写了一些自定义代码,这些代码显示对话框并阻止后台UI。 It works fairly well however we have hit bugs which have taken time to fix. 它工作得很好,但是我们遇到了一些需要花费时间才能修复的错误。 Since we have had some down time we have investigated "better" ways of achieving our desired functionality. 由于我们有一些停机时间,因此我们研究了实现理想功能的“更好”方法。 I have investigated Jquery UI and was able to establish the same functionality in about an hour. 我研究了Jquery UI,并能够在大约一个小时内建立相同的功能。 One issue I have had with Jquery UI is constraining tabbing to the dialog box displayed in IE. 我对Jquery UI遇到的一个问题是将制表符限制为IE中显示的对话框。 In IE the the tab index jumps to the background UI and I believe this issue is recognized in Jquery UI. 在IE中,标签索引跳到后台UI,我相信在Jquery UI中可以识别此问题。 http://bugs.jqueryui.com/ticket/3768 http://bugs.jqueryui.com/ticket/3768

I was able to find a small plugin that fixed this issue for IE, however it broke the tab constraining in Firefox. 我能够找到一个小的插件来解决IE的此问题,但是它打破了Firefox中的标签限制。 I was able to make this work by putting a conditional IE check in my JS and only applying the plugin when the browser is IE. 通过在我的JS中放置条件IE检查并仅在浏览器为IE时应用插件,我才能够完成这项工作。 Under our current approach we do not handle tab constraining, however our consultant believes we can easily accomplish this. 在我们当前的方法下,我们不处理制表符约束,但是我们的顾问认为我们可以轻松实现此目的。

My question is, which is the better approach, create our own custom solution or use Jquery UI + the plugin + the hack? 我的问题是,创建我们自己的自定义解决方案还是使用Jquery UI +插件+ hack是哪种更好的方法? When are IE hacks acceptable? 何时可以接受IE骇客?

I'd go with jQuery UI because at least they'll maintain the library for you, and perhaps eventually release a fix for the issue you're talking about, and then you can remove the hack. 我会选择jQuery UI,因为至少他们会为您维护该库,也许最终会针对您所讨论的问题发布修复程序,然后您可以删除该hack。 Sometimes hacks are necessary. 有时,黑客是必要的。 It beats having to maintain an unthoroughly tested custom library. 无需维护未经严格测试的自定义库。

Writing a framework from scratch is always more difficult and time consuming than hoped because you will run into many issues that you simply cannot account for ahead of time. 从头开始编写框架总是比希望的要困难和耗时,因为您会遇到很多根本无法提前解决的问题。

That said, I would suggest creating a custom facade over the Jquery UI + the plug in + the hack. 就是说,我建议在Jquery UI +插件+ hack上创建一个自定义外观。 This would give you consistent API that meets your project's needs, the use of an established and well-maintained framework and hide some of the peculiarities between browsers. 这将为您提供满足项目需求的一致API,使用已建立且维护良好的框架,并隐藏浏览器之间的某些特性。 (IE hacks are unavoidable.) (IE hack是不可避免的。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM