Loss of selection when clicking a checkmark

I am trying to set a checkbox with a label to work so that when you select text in a contenteditable div clicking on the label does not lose the selection from the div . On the label, you still need to apply the standard tick / untick flag when you click on it, but keep the focus and the attenuation selected on the div .

Performing a simple focus() on a div will not help, since the selection will be removed (and the carriage at the beginning). I could, of course, learn how to store the selection object and try to assign it after clicking the label , but is there an easier way to save the selection ?

(the reason I need to do this with label and checkbox is because I will use jQuery UI buttons and I will need their toggle function)

Similarly, if you check the box, you usually save the selection in a div , but at least on FF4, if you click this checkbox very often (<1s), it will lose the selection. Any idea what is going on there? answered below

example: http://jsfiddle.net/niklasvh/gULM9/

+4
source share
1 answer

This is the Firefox bug noted by 490367.

In accordance with the error description, the double-click function on the input fields will act unusually if the page has a contenteditable div .

I noticed strange behavior, trying to reproduce it manually, so I guessed that it was a mistake. I do not know any workarounds.

0
source

All Articles