模式对话框无法打开辅助对话框
我有一个模态对话框,其中有一些“帮助链接”,可以在其顶部打开其他非模态面板或对话框(同时保持主对话框为模态)。
然而,这些最终总是隐藏在面具后面。 YUI
似乎正在识别最高的 z-index
并将遮罩和模式对话框设置为高于该值。
如果我等待对帮助内容进行面板化,那么我可以将它们设置为具有更高的 z-index。 到目前为止,一切都很好。 那么问题是辅助非模式对话框中的字段无法聚焦。 它们下面的模态对话框似乎以某种方式阻止焦点转移到初始模态对话框之外的任何内容。
如果我可以用 jQuery 实现这种“对话框组模式”,如果 YUI 根本不允许这样做,那也是可以接受的。
帮助!
I have a modal dialog
form which has some "help links" within it which should open other non-modal panels or dialogs on top of it (while keeping the main dialog otherwise modal).
However, these always end up behind the mask. YUI
seems to be recognizing the highest z-index
out there and setting the mask and modal dialog to be higher than that.
If i wait to panel-ize the help content, then i can set those to have a higher z-index. So far, so good. The problem then is that fields within the secondary, non-modal dialogs are unfocusable. The modal dialog beneath them seems to somehow be preventing the focus from going to anything not in the initial, modal dialog.
It would also be acceptable if i could do this "dialog group modality" with jQuery, if YUI simply won't allow this.
Help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
默认情况下,YUI 管理任何扩展 YAHOO.widget.Overlay 的 z-index 并使用覆盖面板。 它通过 YAHOO.widget.Overlay 的“bringToTop”方法来完成此操作。 您可以通过简单地将“bringToTop”方法更改为空函数来关闭此功能:
该代码将永久关闭它,您可以将其放在 container.js 文件的底部。 我发现这种方法有点太过于大锤式的方法,所以我们扩展 YUI 类,并在调用“super.constuctor”之后写入:
如果你这样做,你实际上是在告诉 YUI 你将管理 z-你自己的元素索引。 这可能没问题,但在这样做之前需要考虑一些事情。
By default, YUI manages the z-index of anything that extends YAHOO.widget.Overlay and uses an overlay panel. It does this through the YAHOO.widget.Overlay's "bringToTop" method. You can turn this off by simply changing the "bringToTop" method to be an empty function:
That code would turn it off for good and you could just put this at the bottom of the container.js file. I find that approach to be a little bit too much of a sledge hammer approach, so we extend the YUI classes and after calling "super.constuctor" write:
If you do this, you are essentially telling YUI that you will manage the z-indices of your elements yourself. That's probably fine, but something to consider before doing it.
如果用户要与其他元素交互,那么原始对话框就不能是模态的——这就是模态的定义。 原始对话框真的需要是模态的吗? 如果是这样,您是否尝试在打开其他元素之前切换原始对话框的模式属性?
The original dialog can't be modal if the user is supposed to interact with other elements—that's the definition of modal. Does the original dialog really need to be modal at all? If so, have you tried toggling the modal property of the original dialog before you open the other elements?