Note that there are some explanatory texts on larger screens.

plurals
  1. PODisabling <img> selection and resize inside a contentEditable DIV in IE 9
    primarykey
    data
    text
    <p>I'm working on a project that's trying to implement some editing features using a contentEditable DIV. We're now trying to add support for IE9 (after initally providing Chrome/Safari support) and it's proving to be a challenge. </p> <p>What we are able to do in Chrome is have <code>&lt;img&gt;</code> objects inside a content editable div, and allow those <code>&lt;img&gt;</code> elements to be dragged/dropped, but not resized. Additionally, pressing TAB in the contentEditable div should not select the <code>&lt;img&gt;</code></p> <p>In IE 9, I have found some methods for stopping the images from being resized (like <a href="https://stackoverflow.com/questions/4795132/permitting-moving-only-of-imgs-within-contenteditable-div">Permitting moving only of &lt;img&gt;s within contentEditable &lt;div&gt;</a>) but even that still shows those darn resize handles when clicking on an image. My big problem is that in IE 9, when I'm typing inside the contenteditable div, and I hit TAB, I want the browser to select the next item on the web page (in our application, it is another contentEditable div). This works in Chrome, but in IE, when I hit TAB, the <code>&lt;img&gt;</code> is selected (with the resize handles showing up)</p> <p>Does anyone know if there is a way to disable the 'selection using tab' functionality in IE 9?</p> <p>Here's a simple test case that disables the resizing, still allows drag-and-drop, but the <code>&lt;img&gt;</code> is still selected via TAB:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { //This line below doesn't work in IE9 //document.execCommand("enableObjectResizing", false, false); $('img', '#edit').each(function (i, item) { item.attachEvent("onresizestart", function(e) { e.returnValue = false; }, false); //I thought this below might work for disabling selection, // but it doesn't... item.attachEvent("onbeforeeditfocus", function(e) { e.returnValue = false; }, false); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="edit" contenteditable="true"&gt; Here is some text, and also an &lt;img src="http://img841.imageshack.us/img841/1747/imagead.png" /&gt; image &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload