简体   繁体   English

使用dropdown按钮Dojo多个非模态对话框

[英]Dojo multiple non-modal dialogs with dropdownbutton

I am trying to have multiple dialogs on my page using dijit/Dialog . 我正在尝试使用dijit/Dialog在我的页面上有多个对话框。 I want dialogs to be non-modal so I used this question as a guide to get rid of the background underlay. 我希望对话框是非模态的,所以我用这个问题作为指导来摆脱背景底层。

However when I use a DropDownButton for toggling the windows I'm getting weird behavior. 然而,当我使用DropDownButton来切换窗口时,我得到了奇怪的行为。 When one dialog is showing everything works fine. 当一个对话框显示一切正常时。 When both dialogs are showing the dropdownbuttons will flicker showing/hiding when clicked instead of just hiding 当两个对话框都显示时,下拉按钮会在单击时闪烁显示/隐藏而不是隐藏

Here is the JSFiddle . 这是JSFiddle To reproduce... 要重现......

  1. Show both dialogs under "I" 在“I”下显示两个对话框
  2. Click on "I" again 再次点击“我”

"I" will now flicker. “我”现在会闪烁。 Sometimes if you click on "B" with both dialogs showing it will fix itself. 有时,如果你点击“B”,两个对话框都显示它会自行修复。 If both dialogs are closed the issue will be fixed. 如果两个对话框都关闭,则问题将得到解决。

I figured it had something to do with the z-index of the dialogs, but the DropDownButton seems to always have a higher z-index than the underlay and the dialog itself. 我认为它与对话框的z-index有关,但是DropDownButton似乎总是具有比底衬和对话框本身更高的z-index。

The other option is making my own FloatingPane but I'd like to see if this can work. 另一个选择是制作我自己的FloatingPane但我想看看这是否可行。

Might be a bit late, but could help others out. 可能会有点晚,但可以帮助其他人。

The issue here is that the Dojo Dialogs do their best to keep themselves focused, to the point where when they lose focus, they call .focus() on themselves again ( See dijit/Dialog.js ). 这里的问题是Dojo Dialogs尽最大努力使自己保持专注,当他们失去焦点时,他们再次调用.focus()参见dijit / Dialog.js )。

As far as I can tell, there's no setting to disable this. 据我所知,没有设置禁用它。 However, you can always override the .focus() function for non-modal dialogs to do nothing instead. 但是,您始终可以覆盖非模态对话框的.focus()函数,而不执行任何操作。 EG, 例如,

var dialog = registry.byId("myDialog");
dialog.focus = function() { };
dialog.show();

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

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