CodeMirror selection and radio button labels


I’m using version 5.30. I have a set of radio buttons to control drag drop. When I have text selected in CodeMirror I can’t click on the radio button labels to set the radio buttons. The labels are parent style and the buttons don’t have names so I have script to make sure only one is active. Is there any way to fix this?

	function handleRadios(group, dataValue) {
		var cm =;
		var radios = group.querySelectorAll("input");, i) {
			radio.checked = (radio.getAttribute("data-value") == dataValue);

This doesn’t seem like it should have anything to do with CodeMirror (which might be reflected by the fact that the cm variable in the code snippet is entirely unused).


“var cm =;” is just something I’ve gotten into the habit of typing at the beginning of every function. I’ll take it out.

I’ve done some diagnostics: when no text is selected in the editor, my event listener picks up two click events, one from a span inside the label then another from the radio button; when text is selected, it picks up only the click from the span in the label. In an earlier version I had a sibling style label and I had the same problem.

Here’s the HTML

		'<span class="tb-drag-drop-span '+float+' '+display+'">'+
			'<span class="text-span tooltip">'+this.getPhraseOrIcon("drag_drop", true)+'</span>'+
			'<span class="tb-drag-drop">'+
				'<label class="label-span tooltip">'+
					'<input type="radio" class="tb-off radio OptionClick" data-value="off" data-action="updateDragDrop" checked="checked" />'+
					this.getPhraseOrIcon("off", true)+

				'<label class="label-span tooltip">'+
					'<input type="radio" class="tb-copy radio OptionClick" data-value="copy" data-action="updateDragDrop" />'+
					this.getPhraseOrIcon("copy", true)+

				'<label class="label-span tooltip">'+
					'<input type="radio" class="tb-move radio OptionClick" data-value="move" data-action="updateDragDrop" />'+
					this.getPhraseOrIcon("move", true)+

And the listener

	CodeMirror.on(this.container, "click", onClick = function(e) {;
		if("Click")) {				
			tools["data-action")].call(tools, e);
		if("OptionClick")) {
			var value ="data-value")
			tools["data-action")].call(tools, value)

And the method called

ToolBars.prototype.updateDragDrop = function(dataValue) {    //"update")
	var cm =;
	cm.setOption("dragDrop", (dataValue != "off"));
	this.moveOnDrag = (dataValue == "move");
	handleRadios(this.elt.dragDrop, dataValue);