Bug 159 - [cwc2 1.0.4] query re-submitted unexpectedly
: [cwc2 1.0.4] query re-submitted unexpectedly
Status: RESOLVED FIXED
: Chameleon
Widget
: 1.0
: PC Windows 2000
: P1 major
: ---
Assigned To:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2003-12-09 10:59 by
Modified: 2003-12-22 15:16 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2003-12-09 10:59:32
In the IOOS prototype http://www.mapsherpa.com/ioos/ a query can be resubmitted 
when it is not requested. Here are the steps to reproduce:

- launch application (http://www.mapsherpa.com/ioos/)
- do a point query
- close the query results window
- change the month in the Time Filter
- the query will be resubmitted
------- Comment #1 From 2003-12-09 11:04:19 -------
This may only be a problem in IE. I tested it in IE 6 and reproduced it fairly 
reliably although sometimes it doesn't occur. argh. In Netscape 7.1 I could not 
reproduce it.
------- Comment #2 From 2003-12-09 19:55:00 -------
I was able to reproduce it in Firebird (which is Mozilla, which is Netscape 7.x)
by following Dean's steps outlined above on my first try, darn!

Investigating now ...
------- Comment #3 From 2003-12-09 20:03:52 -------
This is an interesting bug.  Basically, it has to do with something called
'event bubbling' in javascript (which is handled differently by all browsers). 
You should get the same effect if you select the zoom in tool, then change the
time (without zooming in), you will zoom in.  The dropdown combo for the time
widget appears over the map, when you click on an entry, a mouse click event is
generated that is handled by various event handlers.  In some browsers, if a
custom onclick event handler is provided, then the default behaviour is to pass
the event to other objects in the page that contain the mouse unless one of the
event handlers explicitly cancels it.  In the case of chameleon, the main mouse
event handlers related to the map are actually registered at the document level,
which means that any event that occurs will eventually bubble to these functions
unless canceled - hence if you click on a select item that overlaps the map, and
the event handler doesn't cancel it, it will appear to chameleon as if the user
clicked on the map.  The same effect happens with the scrollbar in some
browsers.  If a navigation tool (or query) is selected, and either scrollbar is
over the map and the user scrolls the scrollbar, then the mouse click ends up in
the chameleon event handler even though it shouldn't.  There is no known
work-around for this problem.  However, in the case of the time widget, I think
that we can add code to the onclick event handler to prevent the onclick event
from being propogated to other objects in the page.

Reassigning to Bill since he worked on this widget.  Bill, discuss with me when
you get to this one.
------- Comment #4 From 2003-12-09 20:05:27 -------
Once we figure out how to handle this, it needs to be documented as standard
procedure for widget developers to include cancelling event bubbling in any
javascript event handlers ... and should go into our QA process somewhere to
validate this somehow ... probably through manual code reviews would be the only
way.
------- Comment #5 From 2003-12-10 14:37:00 -------
It looks like this happens when a drop down list goes over the map image and 
the user selects an item that overlaps the map. It seems that this bug never 
happens when a choice is made that does not overlap the map, and that it 
*sometimes* happens when the choice overlaps the map.

For example, if you choose December it might happen because December is at the 
bottom of the list, which overlaps the map. If you choose January you should 
never get the problem.
------- Comment #6 From 2003-12-11 11:36:22 -------
appears to be IE only now.
------- Comment #7 From 2003-12-15 09:29:51 -------
Tip: I've already seen that problem before. Not sure if it's related, but when a
CWC2 template have widgets building some JS code referencing to empty images
(eg: myimg.src = "";) the "browser" was trying to load the empty image anyway.
Some browser was adding the full current path to the empty image that caused the
reload of the template (not visible becose it's a image).
------- Comment #8 From 2003-12-15 09:35:17 -------
I remember that it was happenning in js code (assinging images to button). I 've
already fixed that in 1.1. Just checking if image url is empty before loading it.
------- Comment #9 From 2003-12-17 14:48:49 -------
Has there been any progress on this bug? I hate to be a nag but this bug 
presents a major usability issue in the IOOS demo application and really should 
be fixed. It may also affect any number of other CWC2 applications out there.
------- Comment #10 From 2003-12-17 21:21:22 -------
Thanks for the tip Sacha, I will look into that specifically.  I did spend a bit
of time checking the event idea, I don't think that is the problem in this case
(although in general, it is a problem).  Next direction is Sacha's hint I think.

can this be coded to IOOS?
------- Comment #11 From 2003-12-22 15:16:24 -------
this is a very odd bug because it does seem to come from the onclick event but
it doesn't seem possible to prevent the event bubbling from happening using the
published way of doing it.  There doesn't seem to be a problem with empty images.

So I fixed this by detecting the target of the event in the query handling
javascript, and if the target is not the map then the query widget ignores it.

fixed in chameleon 1.0.6 available from:

http://www.maptools.org/dl/chameleon/chameleon-1.0.6-20031222.tar.gz
http://www.maptools.org/dl/chameleon/chameleon-1.0.6-20031222.zip