Fix stuck-spinners in entity properties

This commit is contained in:
Ryan Huffman 2015-04-14 10:11:52 -07:00
parent fe482b35ff
commit b6942e2300

View file

@ -508,18 +508,22 @@
// To make this work we block the first mouseup event after the elements // To make this work we block the first mouseup event after the elements
// received focus. If we block all mouseup events the user will not // received focus. If we block all mouseup events the user will not
// be able to click within the selected text. // be able to click within the selected text.
// We also check to see if the value has changed to make sure we aren't
// blocking a mouse-up event when clicking on an input spinner.
var els = document.querySelectorAll("input, textarea"); var els = document.querySelectorAll("input, textarea");
for (var i = 0; i < els.length; i++) { for (var i = 0; i < els.length; i++) {
var clicked = false; var clicked = false;
var originalText;
els[i].onfocus = function() { els[i].onfocus = function() {
originalText = this.value;
this.select(); this.select();
clicked = false; clicked = false;
}; };
els[i].onmouseup = function(e) { els[i].onmouseup = function(e) {
if (!clicked) { if (!clicked && originalText == this.value) {
e.preventDefault(); e.preventDefault();
clicked = true;
} }
clicked = true;
}; };
} }
} }