Do not close modal if escape is pressed on select

The modal no longer fades out when pressing escape if a select is
open. After this, the select input is unfocused, so the second press
on escape will still close the modal.

Fixes bug #1265869

Change-Id: I49fa4431152fa3101bb6fafa6e07c8f908396ba8
This commit is contained in:
Maxime Vidori 2014-01-03 18:00:53 +01:00
parent fb0d5e4aaa
commit 37e4403ee8
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.