Bug 166690 - Setting value of generated <input> programatically does not remove the placeholder text
Summary: Setting value of generated <input> programatically does not remove the placeh...
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari 10
Hardware: Unspecified OS X 10.11
: P2 Normal
Assignee: Nobody
URL: https://gist.github.com/uptonic/6b93c...
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-04 12:15 PST by scott
Modified: 2023-06-28 18:06 PDT (History)
3 users (show)

See Also:


Attachments
Test Case + Fix (1.17 KB, text/html)
2017-01-04 12:15 PST, scott
no flags Details
GIF of Issue (12.58 KB, image/gif)
2017-01-04 12:16 PST, scott
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description scott 2017-01-04 12:15:08 PST
Created attachment 298037 [details]
Test Case + Fix

Setting input.value on an <input> field does not reliably redraw if it has placeholder text when that <input> has been generated programatically. This leads to situations where the input.value is displayed *on top of* the placeholder text.

Steps to reproduce:

1) Generate a new <input> via javascript
2) Assign this <input> a placeholder attribute
3) Append <input> to the document.body
4) Set the value of the <input> (w/timeout as this won't happen immediately)
5) Notice that the input.value is displayed on top of the placeholder

The workaround is to toggle input.readOnly on/off again while setting input.value (see attached).
Comment 1 scott 2017-01-04 12:16:50 PST
Created attachment 298038 [details]
GIF of Issue
Comment 2 scott 2017-01-04 12:19:09 PST
Note: This issue is most easily reproduced when the web inspector is open.
Comment 3 Jayden Irwin 2017-05-09 17:19:51 PDT
This issue occurs with <input>s not created by javascript too. I'm on Safari TP 29.
Comment 4 Ahmad Saleem 2023-06-28 17:58:55 PDT
I am not able to reproduce this in WebKit ToT using attached test case.
Comment 5 Karl Dubost 2023-06-28 18:06:23 PDT
This report was done for Safari 10. 
and it is not happening for me in Safari 17. 
It has been probably fixed along the way, but I don't know when. 

Closing as WORKSFORME