Commit 12496549 authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge "Fix the handler functions for mouse click. (Bug 1336529)" into 1.9_STABLE

parents 69d9e9e7 ac9a0b23
......@@ -1010,6 +1010,12 @@
});
}
/**
* return true if the mousedown is <LEFT BUTTON> or the keydown is <Space> or <Enter>
*/
function isHit(e) {
return (e.which == 1 || e.button == 11 || e.keyCode == 13 || e.keyCode == 32);
}
/*
* Initialises the dialog used to add and move blocks
*/
......@@ -1017,8 +1023,8 @@
$('body').append($('#addblock'));
$('#addblock').css('width', 500);
$('#addblock .submit').on('click keydown', function(e) {
if (e.type == 'click' || e.keyCode == 13 || e.keyCode == 32) {
$('#addblock .submit').on('mousedown keydown', function(e) {
if (isHit(e)) {
var position = $('#addblock .cellchooser input:checked').val().split('-');
var order = $('#addblock_position').prop('selectedIndex') + 1;
closePositionBlockDialog(e, {
......@@ -1028,13 +1034,8 @@
}
});
$('#addblock .cancel, #addblock .deletebutton').on('click keydown', function(e) {
// Stops various errors with click event being run on focus
if ((e.type == 'click' && e.buttons < 1) || e.keyCode == 32) {
e.stopPropagation();
e.preventDefault();
}
else if (e.type == 'click' || e.keyCode == 13) {
$('#addblock .cancel, #addblock .deletebutton').on('mousedown keydown', function(e) {
if (isHit(e)) {
closePositionBlockDialog(e, {'saved': false});
}
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment