contenteditable in iframe cannot be edited in iOS after any touch event

Originator:andrewrn
Number:rdar://14773810 Date Originated:19-Aug-2013 06:12 PM
Status:Open Resolved:
Product:Safari Product Version:5.1, 6.1
Classification: Reproducible:Yes
 
19-Aug-2013 06:12 PM Andrew Nicols:
Summary:
If you have an iframe on a page, where the iframe contains a contenteditable area, and the window has any touch event present (touchstart, touchmove, or touchend), it is impossible to edit the contenteditable area after touching the page in any way.

Steps to Reproduce:
See attached files:
* Open the index.html file in iOS Safari
* touch to edit the contenteditable region
* add some content to the region using the onscreen keyboard (or bluetooth)
* touch anywhere on the screen (including to move to a different word)
* try to continue typing (does not work)
* close the keyboard
* touch the screen again
* try to type again (works now)
* repeat if desired

Expected Results:
Typed letters appears on screen

Actual Results:
Letters are not displayed

Regression:

Notes:
This is repeatable with any touch event. Try modifying the JS to only include any one of the touch events (touchstart, touchmove, touchend).
I've tried returning false, and ev.preventDefault() to see if these have any effect (none).
Please note that this works as expected with iOS Chrome.

19-Aug-2013 06:12 PM Andrew Nicols:
'testcase.zip' was successfully uploaded

19-Aug-2013 07:31 PM Andrew Nicols:
I've found a workaround:
iframe.contentWindow.document.addEventListener('keydown', function() {
  iframe.contentWindow.focus();
});

19-Aug-2013 07:34 PM Andrew Nicols:
Also interesting to note is that this is not an issue if the contenteditable is not in an iframe.

I should note that this affects TinyMCE *anywhere* that touch events are present so there's potentially a very large number of affected users.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!