From drupal core ajax.js:
<?php
Drupal.ajax.prototype.keypressResponse = function (element, event) {
// Create a synonym for this to reduce code confusion.
var ajax = this;
// Detect enter key and space bar and allow the standard response for them,
// except for form elements of type 'text' and 'textarea', where the
// spacebar activation causes inappropriate activation if #ajax['keypress'] is
// TRUE. On a text-type widget a space should always be a space.
if (event.which == 13 || (event.which == 32 && element.type != 'text' && element.type != 'textarea')) {
$(ajax.element_settings.element).trigger(ajax.element_settings.event);
return false;
}
};
?>
I propose changing line 98 of horizontal-tabs/horizontal-tabs.js to:
<?php
if (event.keyCode == 13 && event.target.type != "textarea" && event.target.type != "text") {
?>
Comments
Comment #0.0
arosboro commentedUpdated issue summary.
Comment #1
nils.destoop commentedThis works the same like drupal core js. See line 87 of misc/vertical-tabs.js
Comment #2
Ali yah commentedIm sorry Im a beginner, and I dont get it.
Im trying to detect ENTER keypress event in my textfield but it doesnt work. What file should I edit? Below is my code:
Comment #3
kajal bhawsar commented