Bug 50326 - disabled checkboxes are still clickable, though it's grayed out
Summary: disabled checkboxes are still clickable, though it's grayed out
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: 3.0.3
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-07 10:01 UTC by Simon Ejsing
Modified: 2003-06-02 01:29 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Ejsing 2002-11-07 10:01:10 UTC
Version:           3.0.3 (using KDE KDE 3.0.3)
Installed from:    Compiled From Sources
Compiler:          gcc version 2.95.3 20010315 (release) 
OS:          Linux

If I disable a checkbox it is grayed out correctly, however I'm still able to click it, all other browsers I've tried this in does not allow a onclick event if the checkbox is disabled. Either I am using the wrong event or it's a bug...

The code I use is this:
<form name="blah">
<input disabled type="checkbox" name="check1x1" OnClick="alert('clicked');">
</form>
Comment 1 Daniel Naber 2002-11-10 02:10:03 UTC
No checkmark will appear, but the JS popup will. 
Comment 2 Dirk Mueller 2003-06-02 01:29:11 UTC
Subject: kdelibs/khtml [POSSIBLY UNSAFE]

CVS commit by mueller: 

ignore events that shouldn't be sent to us in the first place
CCMAIL: 50326-done@bugs.kde.org


  M +26 -2     khtmlview.cpp   1.517 [POSSIBLY UNSAFE: qDebug]


--- kdelibs/khtml/khtmlview.cpp  #1.516:1.517
@@ -535,4 +535,10 @@ void KHTMLView::viewportMousePressEvent(
     m_part->xmlDocImpl()->prepareMouseEvent( false, xm, ym, &mev );
 
+    // Qt bug: sometimes Qt sends us events that should be sent
+    // to the widget instead
+    if ( mev.innerNode.handle() && mev.innerNode.handle()->renderer() &&
+         mev.innerNode.handle()->renderer()->isWidget() )
+        return;
+
     if (d->clickCount > 0 &&
         QPoint(d->clickX-xm,d->clickY-ym).manhattanLength() <= QApplication::startDragDistance())
@@ -612,4 +618,11 @@ void KHTMLView::viewportMouseMoveEvent( 
     DOM::NodeImpl::MouseEvent mev( _mouse->stateAfter(), DOM::NodeImpl::MouseMove );
     m_part->xmlDocImpl()->prepareMouseEvent( false, xm, ym, &mev );
+
+    // Qt bug: sometimes Qt sends us events that should be sent
+    // to the widget instead
+    if ( mev.innerNode.handle() && mev.innerNode.handle()->renderer() &&
+         mev.innerNode.handle()->renderer()->isWidget() )
+        return;
+
     bool swallowEvent = dispatchMouseEvent(EventImpl::MOUSEMOVE_EVENT,mev.innerNode.handle(),false,
                                            0,_mouse,true,DOM::NodeImpl::MouseMove);
@@ -701,16 +714,27 @@ void KHTMLView::viewportMouseReleaseEven
     viewportToContents(_mouse->x(), _mouse->y(), xm, ym);
 
-    //kdDebug( 6000 ) << "\nmouseReleaseEvent: x=" << xm << ", y=" << ym << endl;
+    kdDebug( 6000 ) << "\nmouseReleaseEvent: x=" << xm << ", y=" << ym << endl;
 
     DOM::NodeImpl::MouseEvent mev( _mouse->stateAfter(), DOM::NodeImpl::MouseRelease );
     m_part->xmlDocImpl()->prepareMouseEvent( false, xm, ym, &mev );
 
+    // Qt bug: sometimes Qt sends us events that should be sent
+    // to the widget instead
+    if ( mev.innerNode.handle() && mev.innerNode.handle()->renderer() &&
+         mev.innerNode.handle()->renderer()->isWidget() )
+        return;
+
     bool swallowEvent = dispatchMouseEvent(EventImpl::MOUSEUP_EVENT,mev.innerNode.handle(),true,
                                            d->clickCount,_mouse,false,DOM::NodeImpl::MouseRelease);
 
+    qDebug("clickCount: %d, mL: %d",
+           d->clickCount, QPoint(d->clickX-xm,d->clickY-ym).manhattanLength());
+
     if (d->clickCount > 0 &&
-        QPoint(d->clickX-xm,d->clickY-ym).manhattanLength() <= QApplication::startDragDistance())
+        QPoint(d->clickX-xm,d->clickY-ym).manhattanLength() <= QApplication::startDragDistance()) {
+        qDebug( "dispatching CLICK EVENT" );
         dispatchMouseEvent(EventImpl::CLICK_EVENT,mev.innerNode.handle(),true,
                            d->clickCount,_mouse,true,DOM::NodeImpl::MouseRelease);
+    }
 
     if (mev.innerNode.handle())