I have a jQuery dialog for making links in a contentEditable span. The problem is that clicking a button to open the dialog causes the selection to be lost, text input inside the dialog also causes the selection to be lost.
I can fix the button with -moz-user-select:none; but -webkit-user-select:none doesn't work in Chrome.
I can fix the input by wrapping it in an iframe, but that's messy and clicking anywhere else also kills the selection, for example, dragging the dialog around.
I've seen the solution at http://stackoverflow.com/questions/824833/how-to-preserve-text-selection-when-opening-a-jquery-dialog, but that doesn't work in many browsers in a contenteditable element, only real inputs.
Is there a nice solution to my problem?