I am making use of a contenteditable div in combination with the rangy Javascript library to insert HTML at the cursor position.
End of the day the contents of the div commonly looks like:
<div contenteditable="true">
"Hello "
<button contenteditable="false" data-id="147">@John Smith</button>
" "
</div>
Users get suggested upon pressing '@' and get subsequently inserted as a button when selected (ala Google Plus). I also insert a
after this button.
The button gets removed in Chrome/Safari/Firefox when you hit backspace (after first removing the
), but not in IE8. In IE8 the cursor merely jumps over the button without removing it. What's even more bizarre in IE8 is if you leave the
next to the button - and rather place the cursor right next to the button - it removes the button on backspace. So it's happy when there's a
to the right of the cursor.
Does anyone know what I need in order to make IE8 work i.t.o. removing the button upon backspace without the need for a
to the right of the cursor? (some info on this strange behaviour might also help)
P.S. I haven't tested other versions of IE