RESOLVED FIXED 70586
[Forms] Setting defaultValue should hide an input placeholder.
https://bugs.webkit.org/show_bug.cgi?id=70586
Summary [Forms] Setting defaultValue should hide an input placeholder.
yosin
Reported 2011-10-20 23:35:19 PDT
Following HTML should not should placeholder in text field: <input type="text" placeholder="placeholder" id="t"> <script> document.getElementById("t").defaultValue="default"; </script> Expect: Text input field displays "default". Result: Text input field displays both "default" and "placeholder"
Attachments
Patch 1 (3.31 KB, patch)
2011-10-23 22:36 PDT, yosin
no flags
Patch (3.31 KB, patch)
2011-10-23 22:38 PDT, yosin
no flags
Patch (4.13 KB, patch)
2011-10-23 23:15 PDT, yosin
no flags
Patch (4.37 KB, patch)
2011-10-24 00:04 PDT, yosin
no flags
yosin
Comment 1 2011-10-23 22:16:49 PDT
This bug comes from Chromium bug http://crbug.com/93585
yosin
Comment 2 2011-10-23 22:36:50 PDT
yosin
Comment 3 2011-10-23 22:38:00 PDT
yosin
Comment 4 2011-10-23 22:39:14 PDT
Add tkent@ to CC
Darin Adler
Comment 5 2011-10-23 22:42:06 PDT
Comment on attachment 112150 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=112150&action=review Thanks for tackling this. > Source/WebCore/html/HTMLInputElement.cpp:1303 > + updatePlaceholderVisibility(false); This is the wrong way to do it. You also want the placeholder to go away if the value attribute is set directly. For example, if your test said this: document.getElementById("c1").setAttribute("value", "Default"); We need to test both cases, and we need code that works in both cases. The way to do that is to put the code into parseMappedAttribute, in the case for valueAttr. In fact, it should go inside the !hasDirtyValue if statement, since it only needs to run if the default value hasn’t been overwritten.
Kent Tamura
Comment 6 2011-10-23 22:46:04 PDT
Comment on attachment 112150 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=112150&action=review > Source/WebCore/ChangeLog:9 > + Tests: fast/forms/70586-expected.html > + fast/forms/70586.html 70586.html is meaningless. Please name it something representing a test case.
yosin
Comment 7 2011-10-23 23:15:43 PDT
Kent Tamura
Comment 8 2011-10-23 23:35:30 PDT
Comment on attachment 112154 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=112154&action=review > LayoutTests/ChangeLog:13 > + * fast/forms/70586-expected.html: Added. Render text input element with "Default" value. > + * fast/forms/70586.html: Added. Render text input element with placeholder attribute and a script to change default value of input element to "Default" from empty. Please rename the test. Number-only name is hard to imagine the content.
yosin
Comment 9 2011-10-24 00:04:36 PDT
Kent Tamura
Comment 10 2011-10-24 00:06:25 PDT
Comment on attachment 112156 [details] Patch Looks good. Thank you for fixing this.
WebKit Review Bot
Comment 11 2011-10-24 01:13:10 PDT
Comment on attachment 112156 [details] Patch Clearing flags on attachment: 112156 Committed r98222: <http://trac.webkit.org/changeset/98222>
WebKit Review Bot
Comment 12 2011-10-24 01:13:15 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.