Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#17343 closed defect (wontfix)

dijit/form/Select dropdown remains open when Select in OpenLayers dialog

Reported by: Denis Rykov Owned by: Denis Rykov
Priority: undecided Milestone: tbd
Component: Dijit - Form Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description

I'm using dijit/form/Select widget (1.9.1 Release) and faced with the following issue. When I switch items in dropdown menu I get error notifications in console. Using uncompressed scripts I've discovered that errors occurs within byNode method of dijit/registry module:

byNode: function(/*DOMNode*/ node){
    // summary:
    // Returns the widget corresponding to the given DOMNode
    return hash[node.getAttribute("widgetId")]; // dijit/_WidgetBase
},

node.getAttribute("widgetId") returns null. Then I found #17275 and tried to use nightly build for 2013-07-24 from here: http://archive.dojotoolkit.org/nightly/. Now I doesn't get any error notifications but one problem still remains: if I close parent div of dijit/form/Select widget (while dropdown menu is opened) then menu does not disappear.

Here is piece of my code:

var Widget = declare([BorderContainer], {
    style: "width: 100%; height: 100%",
    gutters: false,

    postCreate: function () {
        this.inherited(arguments);

        this.selectOptions = [];

        ...

        this.selectPane = new ContentPane({
            region: "top",
            layoutPriority: 1,
            style: "padding: 0px 4px;"
        });
        this.addChild(this.selectPane);

        this.select = new Select({
            style: "width: 100%",
            options: this.selectOptions
        }).placeAt(this.selectPane);
        ...

Also I've noticed that dropdown menu closes only after second click on any places of page. In 1.8.5 all works fine and dropdown menu closes after first click.

Attachments (3)

dijit-select-issue.html (3.1 KB) - added by Denis Rykov 6 years ago.
dijit-select-issue.7z (1.1 KB) - added by Denis Rykov 6 years ago.
dijit-select-issue-v2.html (3.5 KB) - added by Denis Rykov 6 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 6 years ago by bill

Owner: set to Denis Rykov
Status: newpending

I don't know what you mean by "if I close parent div of dijit/form/Select widget". Maybe you are talking about #1762? Note that the nightly build is broken and that code is very old.

If your problem isn't fixed by #17262 then please attach a test case using the "attach file" button. It should be as small as possible to still reproduce the problem, almost always a single HTML file that we can load in the browser (i.e. not PHP, JSP, etc.).

Then, give exact instructions on how to reproduce the problem using your attached test file, including the browser and version to use.

The test case is necessary both to confirm that there's a bug, and for us to be able to debug the problem.

Alternately, you can give instructions on how to reproduce the problem with an existing test case (in the tests/ directory).

Thanks!

Changed 6 years ago by Denis Rykov

Attachment: dijit-select-issue.html added

comment:2 Changed 6 years ago by Denis Rykov

Status: pendingnew

Attachment (dijit-select-issue.html) added by ticket reporter.

Changed 6 years ago by Denis Rykov

Attachment: dijit-select-issue.7z added

comment:3 Changed 6 years ago by Denis Rykov

bill, thanks for quick response! I've made a little example. Test case:

  1. Press CreatePopUp? button;
  2. Click on dropdown menu;
  3. Press red cross.

Popup will be closed but dropdown menu remains opened. Such behavior is observed in FF and Chrome, but not in IE10

comment:4 Changed 6 years ago by bill

Status: newpending

Can you make a test case without OpenLayers?? Or is the problem limited to popups w/that software? I've never even heard of it.

comment:5 Changed 6 years ago by Denis Rykov

Status: pendingnew

I was trying to eliminate OpenLayers?, but It looks like described error connected with OpenLayers? popups. I cannot reproduce error without it although from OpenLayers?'s popup I use only div container. Maybe any problem wit this div. But on the other side in 1.8.5 all works fine.

Last edited 6 years ago by Denis Rykov (previous) (diff)

comment:6 Changed 6 years ago by Denis Rykov

Here are notes that may help to understand the cause of what is happening:

  1. If we configure OpenLayers?.Map object without controls (controls: []), then all works fine (when we make click on map div - opened menu closes automatically) in nightly build and in 1.8.5. But if we add any controls (by default OpenLayers?.Map object has some of them) that wait user interaction (for example OpenLayers?.Control.Navigation) then opened menu doesn't close automatically when we make click on map div in nightly build, but works fine in 1.8.5.
  2. If press RemovePopUp? button in 1.8.5 you can see the following behavior: dropdown menu closes and then parent div dissapears. But in nightly build (and in 1.9.1) parent div dissapears but dropdown menu remains opened.

I've attached new file which demonstrates described notes. It is reasonably to presume that problem is connected with OpenLayers? not with Dojo, but I cannot figure out why in previos Dojo version this bug doesn't occurs. It looks like in last release something was broken.

Changed 6 years ago by Denis Rykov

Attachment: dijit-select-issue-v2.html added

comment:7 Changed 6 years ago by bill

Resolution: wontfix
Status: newclosed
Summary: Dropdown menu remains opened after close Select widgetdijit/form/Select dropdown remains open when Select in OpenLayers dialog

Thanks for the test case; I can see the issue you are talking about, and it's similar to #17329 in that it's about a third party dialog. In this case it's an OpenLayers? dialog that contains a dijit/form/Select widget.

I'm not sure why this used to work in 1.8.5 but doesn't now. We could trace it back to the revision where it stopped working, but I don't see any point.

I think the practical course of action is for you to make sure that the Select widget has focus (appearing as a blue fuzzy border on chrome, dotted line on IE/firefox, etc). If it has focus, then when the dialog closes and the Select loses focus, the drop down will close.

dijit/Dialog always ensures that the first element has focus. Since you are using an OpenLayers? dialog you need to focus manually. Having focus is intrinsic to how dijit works.

I don't think there's anything we can/should do on the dijit side, so I'm closing this ticket. If you have any questions though you can write back here and I'll read them.

comment:8 Changed 6 years ago by Denis Rykov

Bill, I've found file that cause described issue: dijit/focus.js. If change focus.js to the same from 1.8.5 then bug disappears. Any thoughts?

comment:9 Changed 6 years ago by bill

No new thoughts, I stand by what I said above.

comment:10 Changed 6 years ago by Denis Rykov

More specific: cause of the problem is registerWin method of focus.js. It looks like it is connected with commit: https://github.com/dojo/dijit/commit/9965406f7184e8cee4467efc893ca5d85637b2e1

Last edited 6 years ago by Denis Rykov (previous) (diff)

comment:11 Changed 6 years ago by bill

OK, well if you think the problem started w/that commit, probably you just aren't testing on all the browsers. That commit merely normalized behavior between IE and the other browsers.

Note: See TracTickets for help on using tickets.