Bug 61347 - disabled property not honored for option tag (testcase)
Summary: disabled property not honored for option tag (testcase)
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml forms (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-17 08:09 UTC by michael
Modified: 2003-10-24 17:37 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 michael 2003-07-17 08:09:43 UTC
Version:            (using KDE KDE 3.1)
Installed from:    RedHat RPMs

Konqueror's UI does not follow the HTML 4.01 UI recommendations for disabling an element, when that element happens to be an <option> in a <select> group.  The UI should "gray out" the disabled option and prevent a user from selecting it if the option's disabled property is set.

<select name="s1" multiple>
  <option name="cat">cat</option>
  <option name="dog">dog</option>
  <option name="fish" disabled>fish</option>
</select>

Obviously, JavaScript code that modifies the document to set the disabled property to true or false should have the same effect -- presently it sets the property, but the UI does not reflect its state.
Comment 1 Stephan Kulow 2003-10-22 13:55:32 UTC
we can't gray it out, but we can make it not selectable. Dirk, would you consider the following
patch?

--- rendering/render_form.cpp   20 Oct 2003 23:42:24 -0000      1.244
+++ rendering/render_form.cpp   22 Oct 2003 11:54:21 -0000
@@ -1015,8 +1015,13 @@ void RenderSelect::updateFromElement()
                     text = QString::fromLatin1("    ")+text;
                 }

-                if(m_useListBox)
-                    static_cast<KListBox*>(m_widget)->insertItem(text, listIndex);
+                if(m_useListBox) {
+                    KListBox *l = static_cast<KListBox*>(m_widget);
+                    l->insertItem(text, listIndex);
+                    DOMString disabled = optElem->getAttribute(ATTR_DISABLED);
+                    if (!disabled.isEmpty() && l->item( listIndex ))
+                        l->item( listIndex )->setSelectable( false );
+                }
                 else
                     static_cast<KComboBox*>(m_widget)->insertItem(text, listIndex);
             }
Comment 2 Stephan Kulow 2003-10-24 17:37:50 UTC
Subject: kdelibs/khtml

CVS commit by coolo: 

fixing rendering of disabled select options
CCMAIL: 61347-done@bugs.kde.org


  M +5 -0      ChangeLog   1.51
  M +8 -4      rendering/render_form.cpp   1.245


--- kdelibs/khtml/ChangeLog  #1.50:1.51
@@ -1,2 +1,7 @@
+2003-10-24  Stephan Kulow  <coolo@kde.org>
+
+        * rendering/render_form.cpp (updateFromElement): support disabled attribute
+        select option (#61347)
+
 2003-10-24  Lars Knoll <knoll@kde.org>
         * Make the <button> element work correctly

--- kdelibs/khtml/rendering/render_form.cpp  #1.244:1.245
@@ -1016,7 +1016,11 @@ void RenderSelect::updateFromElement()
                 }
 
-                if(m_useListBox)
-                    static_cast<KListBox*>(m_widget)->insertItem(text, listIndex);
-                else
+                if(m_useListBox) {
+                    KListBox *l = static_cast<KListBox*>(m_widget);
+                    l->insertItem(text, listIndex);
+                    DOMString disabled = optElem->getAttribute(ATTR_DISABLED);
+                    if (!disabled.isEmpty() && l->item( listIndex ))
+                        l->item( listIndex )->setSelectable( false );
+                }  else
                     static_cast<KComboBox*>(m_widget)->insertItem(text, listIndex);
             }