Merge "Do not close modal if escape is pressed on select"

This commit is contained in:
Jenkins 2014-01-07 07:41:46 +00:00 committed by Gerrit Code Review
commit 6fd1a1522a
1 changed files with 8 additions and 0 deletions

View File

@ -140,6 +140,14 @@ horizon.addInitFunction(function() {
topVal = $this.css('top');
$this.css('top', scrollShift + parseInt(topVal, 10));
}
// avoid closing the modal when escape is pressed on a select input
$("select", evt.target).keyup(function (e) {
if (e.keyCode === 27) {
// remove the focus on the select, so double escape close the modal
e.target.blur();
e.stopPropagation();
}
});
});
// Focus the first usable form field in the modal for accessibility.