summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2015-05-25 03:46:41 (GMT)
committerwebchick2015-05-25 03:46:41 (GMT)
commit1a62e3c66dfe91d3dd24beb6828f28243ce856fd (patch)
tree28de6ed81cd76d3d18858588779a3a5265acda5e
parent4ec324ef9ce93ee74f014b40b3cac8308ce4f5e7 (diff)
Issue #2488884 by pixelmord, tim.plunkett, droplet: Machine name HTML5 validation fails when field is hidden
-rw-r--r--core/misc/machine-name.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/misc/machine-name.js b/core/misc/machine-name.js
index 5319aa9..535f9d2 100644
--- a/core/misc/machine-name.js
+++ b/core/misc/machine-name.js
@@ -34,8 +34,7 @@
function clickEditHandler(e) {
var data = e.data;
- e.preventDefault();
- data.$wrapper.show();
+ data.$wrapper.removeClass('visually-hidden');
data.$target.trigger('focus');
data.$suffix.hide();
data.$source.off('.machineName');
@@ -94,7 +93,7 @@
// Figure out the maximum length for the machine name.
options.maxlength = $target.attr('maxlength');
// Hide the form item container of the machine name form element.
- $wrapper.hide();
+ $wrapper.addClass('visually-hidden');
// Determine the initial machine name value. Unless the machine name form
// element is disabled or not empty, the initial default value is based on
// the human-readable form element value.
@@ -137,6 +136,10 @@
// Initialize machine name preview.
.trigger('keyup');
}
+
+ // Add a listener for an invalid event on the machine name input
+ // to show its container and focus it.
+ $target.on('invalid', eventData, clickEditHandler);
});
},