Opened 13 years ago

Closed 12 years ago

Last modified 9 years ago

#2685 closed defect (fixed)

[ContentPane] The ComboBox attempts to hide itself and also fires events when it is no longer on the page

Reported by: guest Owned by: haysmark
Priority: high Milestone: 0.9
Component: Dijit - Form Version: 0.4.2
Keywords: ComboBox Select filters Cc: stenduncan@…
Blocked By: Blocking:

Description (last modified by haysmark)

Test case

main file in tests/form:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
	"http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>ContentPane Test</title>
		
		<script type="text/javascript" src="../testBidi.js"></script>
		
		<script type="text/javascript" src="../../../dojo/dojo.js"
			djConfig="isDebug:true"></script>
		<script type="text/javascript">
			dojo.require("dijit.layout.ContentPane");
			dojo.require("dijit.form.ComboBox");
			dojo.require("dijit.util.manager");
			dojo.require("dijit.util.parser");	// scan page for widgets and instantiate them
		</script>
		<style>
			@import "../../../dojo/resources/dojo.css";
			@import "../../themes/tundra/tundra.css";
			@import "css/dijitTests.css";

			body {
				margin: 1em;
				padding: 1em;
			}

			.box {
			  position: relative;
				background-color: white;
				border: 2px solid black;
				padding: 8px;
				margin: 4px;
			}
		</style>
	</head>
	<body class="tundra">
		<p>pre-container paragraph</p>
<div dojoType="dijit.layout.ContentPane" class="box" href="combotab.html" hasShadow="true" id="test">
					hi
				</div>
				<input type="button" value="Change tab in 3 seconds" onClick='setTimeout("dijit.byId("test").setUrl("../layout/tab2.html")", 3000);'>
		
	</body>
</html>

test/form/combotab.html:

<input dojoType="dijit.form.ComboBox"
			value="California"
			url="comboBoxData.json"
			searchAttr="name"
			name="state2"
			promptMessage="Please enter a state"
			id="datatest"
	>

These are the conditions for reproducing the issue:

  • I have a ContentPane? that has its url updated when events are fired from links outside it.
  • The current page has a Select/ComboBox? on it
  • The ComboBox? has focus and the text within the selected item is hi-lighted (selected by the cursor) - This is the main key to reproducing this issue.
  • An event is fired that causes the ContentPane? to change its url

The Result:

The page is updated and an error is thrown:

Firefox: 'node has no properties'.

IE: 'filters is null or not an object'

Both errors point to:

var opac=node.style.opacity||node.style.MozOpacity||node.style.KhtmlOpacity||1;

in the dojo.html.getOpacity function in dojo.js

The Fix

I was able to prevent this from occuring in Firefox by commenting out the following line in ComboBox?.js: The function _checkBlurred makes a call to this._hideResultList();. After commenting that call, firefox worked fine. This was being called after the page containing the combobox was unloaded.

In IE however, I was still getting an error but a different one. It was attempting to run code that was triggered by an onValueChanged call. This was called after the page containing the combobox was unloaded. To fix this I just made checks that the combo exists before querying it for its value.

I don't know if commenting out the hideResultList() function is a reasonable thing to do, but it works for me.

System Details

  • This issue occurs with build 0.4.2, 0.4.1 and I think it also happened in 0.4.0.
  • Windows 2000 Service Pack 4
  • Firefox 1.5.0.11
  • IE 6.0.2800.1106

Contact

Dave Thomas: davidt@…

Change History (17)

comment:1 Changed 13 years ago by jean-francois.pone@…

a possible solution is (for firefox, not tested with other browsers), to define this method :

uninitialize: function(){

this._handleBlurTimer(true,false);

}

in the ComboBox? widget.

comment:2 Changed 13 years ago by guest

Can confirm this bug. In my case the combobox was destroyed when the contentpane was "hidden". The uninitialize solution above seems to work fine in FF(1.5) and IE(6)

comment:3 Changed 13 years ago by guest

I tried this fix and it solved a problem that I had when destroying my page. Adding myself to cc list (I hope)

comment:4 in reply to:  3 Changed 13 years ago by guest

Replying to guest:

I tried this fix and it solved a problem that I had when destroying my page. Adding myself to cc list (I hope)

comment:5 Changed 13 years ago by tk

Cc: stenduncan@… added

Just adding a user to the CC field per his request.

comment:6 Changed 13 years ago by Douglas Hays

Milestone: 0.9
Owner: changed from bill to haysmark

comment:7 Changed 13 years ago by Adam Peller

Component: WidgetsDijit

comment:8 Changed 13 years ago by haysmark

Priority: highnormal
severity: criticalnormal
Status: newassigned

We actually don't have that blur timer code in 0.9 anymore, and hideResultList does a much better job of checking to see if the popup menu is still there, so it probably works fine now.

"An event is fired that causes the ContentPane? to change its url" sounds hard to reproduce though, but I will see what I can do. A test case from 0.4 would be nice.

comment:9 Changed 13 years ago by haysmark

Description: modified (diff)

So I was right; it's not a problem in ComboBox? anymore. However, there are just a few trivial problems in 0.9 that prevent it from working 100%.

comment:10 Changed 12 years ago by Douglas Hays

Resolution: fixed
Status: assignedclosed

(In [9020]) Fixes #2685, #3357. Proxy commit for haysmark. Addresses regression created by [8995] where the popups had 0 height. _DropDownTextBox does not set position:absolute on the popup anymore. FormElement? widgets now have their mouse handlers properly disconnected on destroy. ComboBox? on destruction attempts to call close before destroying its popup. popup.js close checks to see if the popup widget exists before setting its style.

comment:11 Changed 12 years ago by haysmark

Resolution: fixed
Status: closedreopened

Regression in [9236] created by fadeout code broke this again.

comment:12 Changed 12 years ago by haysmark

Priority: normalhigh
severity: normalmajor
Summary: The ComboBox attempts to hide itself and also fires events when it is no longer on the page[ContentPane] The ComboBox attempts to hide itself and also fires events when it is no longer on the page

comment:13 Changed 12 years ago by bill

Resolution: fixed
Status: reopenedclosed

(In [9246]) Rollback [9236].

Making popup closing asynchronous is complicated and isn't suitable to a quick fix like this.

Fixes #3489, #2685. Refs #3360.

comment:14 Changed 12 years ago by haysmark

Priority: highnormal
Resolution: fixed
severity: majornormal
Status: closedreopened

[9024] also creates a small regression in that it uses dojo.connect instead of this.connect in _FormWidget.

comment:15 Changed 12 years ago by bill

Resolution: fixed
Status: reopenedclosed

(In [9254]) _FormWidget uses this.connect again to clean up the mouse handlers on widget destruction. Fixes #2685.

Patch from Mark Hays (IBM, CCLA on file)

comment:16 Changed 10 years ago by bill

(In [20819]) Should still recycle wrapper and iframe even when the popup widget has been deleted. Refs #2685, [9020].

comment:17 Changed 9 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.