<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>16890</bug_id>
          
          <creation_ts>2008-01-16 01:59:33 -0800</creation_ts>
          <short_desc>Returning false from document.onmouseup/down blocks &lt;select&gt; menus from appearing</short_desc>
          <delta_ts>2024-05-01 20:07:09 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>523.x (Safari 3)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>UNCONFIRMED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc>http://www.glucosurfer.org/goto?diagram&amp;language=en&amp;user=278&amp;share=3788281</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Holger Schmeken">holger.schmeken</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>aroben</cc>
    
    <cc>oliver</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>67346</commentid>
    <comment_count>0</comment_count>
    <who name="Holger Schmeken">holger.schmeken</who>
    <bug_when>2008-01-16 01:59:33 -0800</bug_when>
    <thetext>My project uses event handlers for onmousedown and onmouseup. When these event handlers are registered for the document object the select boxes are not clickable anymore. It seems that that the handler is consuming all mouse events which prevents the select box from handling it. This happens only on safari and on all mac and windows versions (as far as I could test that).

Now I have registered the handlers for the appropriate div alone and it works flawlessly.

// this will cause a problem on apple safari
//
// document.onmousedown = MouseDown;
// document.onmouseup = MouseUp;
//
// now the solution for all browsers
//
x = document.getElementById(&quot;cage_image&quot;);
if (x)
{
  x.onmousedown = MouseDown;
  x.onmouseup = MouseUp;
}

You will find the section in the javascript code of my page.

Best regards,
Holger Schmeken</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67361</commentid>
    <comment_count>1</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2008-01-16 07:54:05 -0800</bug_when>
    <thetext>Here&apos;s the definition of the MouseDown and MouseUp functions from the page:

function MouseDown(e) 
{
	var found = false;
	var obj;
 
	if (isW3C)
	{
		obj = e.target;
	}
	else if (isIE)
	{
		e = window.event;
		obj = e.srcElement;
	}
	else return;
 
	if (   (obj.parentNode.id != null)
	    &amp;&amp; (obj.parentNode.id.indexOf(MainId) != -1))
	{
		current = obj.parentNode.style;
 
		dx = parseInt(e.clientX) - parseInt(current.left);
 
		if (isW3C)
		{
			document.addEventListener(&quot;mousemove&quot;, MouseDrag, true);
			current.cursor = &quot;url(ImageGlucosurfer/hand-closed.ico),move&quot;;
		}
		else
		{
			document.attachEvent(&quot;onmousemove&quot;, MouseDrag);
			current.cursor = &quot;url(ImageGlucosurfer/hand-closed.ico),move&quot;;
		}
	}
	else
	{
		current = null;
	}
	return false;
}

function MouseUp(e)
{
    var x;
    
	if (isW3C)
	{
		document.removeEventListener(&quot;mousemove&quot;, MouseDrag, true);
	}
	else if (isIE)
	{
		document.detachEvent(&quot;onmousemove&quot;, MouseDrag);
	}
 
	if (current)
	{
		current.cursor = &quot;url(ImageGlucosurfer/hand-open.ico),default&quot;;
    }
 
	current = null;
	return false;
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67362</commentid>
    <comment_count>2</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2008-01-16 07:55:12 -0800</bug_when>
    <thetext>The event handlers are returning false or undefined, which means that the default processing of the event is being blocked. In general Safari is behaving correctly here, but I wonder if we should consider behaving more like IE/FFx and never let the &lt;select&gt; menu action be blocked?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67385</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-01-16 10:48:02 -0800</bug_when>
    <thetext>Could you please clarify how to reproduce the problem?

The only non-clickable select I see (Zoom) is not a descendant of cage_image div, so the mouse event handler is not invoked. And this select is also disabled in Firefox.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67418</commentid>
    <comment_count>4</comment_count>
    <who name="Holger Schmeken">holger.schmeken</who>
    <bug_when>2008-01-16 16:05:16 -0800</bug_when>
    <thetext>&gt; The only non-clickable select I see (Zoom) is not a descendant of cage_image
&gt; div, so the mouse event handler is not invoked. And this select is also
&gt; disabled in Firefox.

The page is now compatible with Safari. The non-clickable select (Zoom) is non-clickable on purpose. BUT the select (Diagram) was not clickable when the event handler was registered for the document. Adam Robens response was that my Mouse Handler has caused the problem by returning improper return values. The other browsers seem handle this situation in a more friendly way. They will allow the select box to handle the mouse messages - even when the handler is misbehaving.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67444</commentid>
    <comment_count>5</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2008-01-16 23:51:10 -0800</bug_when>
    <thetext>adam are you sure return false/undefined prevents default handling from occuring, i thought it was the other way  round (although i really can remember for sure).  Given functions return undefined by default that would imply a simple handler would result in blocking the default behaviour, which seems unlikely.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67445</commentid>
    <comment_count>6</comment_count>
    <who name="Dave Hyatt">hyatt</who>
    <bug_when>2008-01-16 23:55:30 -0800</bug_when>
    <thetext>WebKit handling is correct here IMO.   I think we should file a bug on Firefox/Gecko about this issue.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67449</commentid>
    <comment_count>7</comment_count>
    <who name="Holger Schmeken">holger.schmeken</who>
    <bug_when>2008-01-17 00:59:48 -0800</bug_when>
    <thetext>Hi Dave,

&gt; WebKit handling is correct here IMO.   I think we should file a bug on
&gt; Firefox/Gecko about this issue.

FireFox, IE, Opera, Konqueror and many other browsers will handle their select boxes even with buggy handlers. This means that many pages will exist where designers have made the same mistake that I did. In conclusion Safari can fail on these pages so I would recommend a fault tolerant handling of the problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2032695</commentid>
    <comment_count>8</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-05-01 20:07:09 -0700</bug_when>
    <thetext>&lt;rdar://problem/127402831&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>