Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Double clicking on a div with contenteditable inside and iframe disables div

If i create a div that has contenteditable true inside of an iframe and if you double click it it becomes non functional.the focus is still in the iframe and you can see the cursor, however it does not respond to keydown

Does anyone have an idea of how I can i overcome this?

EDIT:

i have implemented a dojo editor. if you open this link in ipad you will see the problem as described above.

like image 417
Nisanth Sojan Avatar asked May 18 '13 09:05

Nisanth Sojan


Video Answer


2 Answers

Which OS you are using? You should make sure that you are using OS 5.0 or later. According to the (Apple's Technical Notes) and Safari Web Content Guide. It is written:

The HTML contenteditable attribute is supported in iOS 5.0 and later. In earlier versions, replace contenteditable, used to enable text input within a styled element, with a styled textarea element. In Safari, you can customize the appearance of textarea elements using CSS. If necessary, you can even disable any platform-specific, built-in styling on a textarea element by setting -webkit-appearance to none.

So, if you are using an old OS version, you could use textarea elements instead of contenteditable. Then, it is guaranteed that your application will work as well.

PS. you can use your IPAD to go on this website, to try how does it work with textarea. It might be an example for you.

Hope that helps.

like image 168
lvarayut Avatar answered Oct 20 '22 00:10

lvarayut


Trying to get a contenteditable div to work inside of an iframe is one level of complicated, if you are trying to get it to work inside of a specific WYSIWYG editor like Dojo editor, is another level harder, as there is a lot of JavaScript affecting the interactions. It would help to explain the parameters a little better in your question.

Have you used a browser debugger (like Firebug) to see what's happening when you click?

This other SO question and answer about contenteditable div vs iframe is useful.

Finally, if you are using iOS Safari, make sure you are using Safari 5.0 or better as the contenteditable attribute was only recently supported on that browser.

EDIT: Since you are using iOS 6, you should be using the iOS Safari JavaScript Debugger to let you know what's happening a little more clearly when you click on the editable div. If you can find some more specific error messages, please update us.

like image 28
Dan Sorensen Avatar answered Oct 19 '22 23:10

Dan Sorensen