Fix bug when aborting dragging with ESC key didn't stop the move action (#6623)

+ small code improvements
+ focus the list on drag start to make sure it's focused state is up-to-date
  which is needed for proper keypress handling (e.g. ESC key on drag action)
pull/6629/head
Aleksander Machniak 6 years ago
parent b2b39ade23
commit 26bce22bff

@ -66,6 +66,7 @@ CHANGELOG Roundcube Webmail
- Fix so ANY record is not used for email domain validation, use A, MX, CNAME, AAAA instead (#6581) - Fix so ANY record is not used for email domain validation, use A, MX, CNAME, AAAA instead (#6581)
- Fix so mime_content_type check in Installer uses files that should always be available (i.e. from program/resources) (#6599) - Fix so mime_content_type check in Installer uses files that should always be available (i.e. from program/resources) (#6599)
- Fix missing CSRF token on a link to download too-big message part (#6621) - Fix missing CSRF token on a link to download too-big message part (#6621)
- Fix bug when aborting dragging with ESC key didn't stop the move action (#6623)
RELEASE 1.4-beta RELEASE 1.4-beta
---------------- ----------------

@ -1695,6 +1695,7 @@ function rcube_webmail()
if (menu) { if (menu) {
$(menu).hide(); $(menu).hide();
} }
this.command(action, this.env.drag_target); this.command(action, this.env.drag_target);
this.env.drag_target = null; this.env.drag_target = null;
}; };
@ -1724,7 +1725,8 @@ function rcube_webmail()
else if (list = this.contact_list) else if (list = this.contact_list)
model = this.env.contactfolders; model = this.env.contactfolders;
if (this.drag_active && model && this.env.last_folder_target) { // Note: we accept only mouse events to ignore dragging aborts with ESC key (#6623)
if (this.drag_active && model && this.env.last_folder_target && !rcube_event.is_keyboard(e)) {
var target = model[this.env.last_folder_target]; var target = model[this.env.last_folder_target];
list.draglayer.hide(); list.draglayer.hide();
@ -1809,7 +1811,7 @@ function rcube_webmail()
// remove focus from list widgets // remove focus from list widgets
if (window.rcube_list_widget && rcube_list_widget._instances.length) { if (window.rcube_list_widget && rcube_list_widget._instances.length) {
$.each(rcube_list_widget._instances, function(i,list){ $.each(rcube_list_widget._instances, function(i,list) {
if (list && !rcube_mouse_is_over(e, list.list.parentNode)) if (list && !rcube_mouse_is_over(e, list.list.parentNode))
list.blur(); list.blur();
}); });
@ -1824,7 +1826,7 @@ function rcube_webmail()
} }
// reset popup menus; delayed to have updated menu_stack data // reset popup menus; delayed to have updated menu_stack data
setTimeout(function(e){ setTimeout(function(e) {
var obj, skip, config, id, i, parents = $(target).parents(); var obj, skip, config, id, i, parents = $(target).parents();
for (i = ref.menu_stack.length - 1; i >= 0; i--) { for (i = ref.menu_stack.length - 1; i >= 0; i--) {
id = ref.menu_stack[i]; id = ref.menu_stack[i];

@ -642,6 +642,7 @@ drag_row: function(e, id)
rcube_event.add_listener({event:'mousemove', object:this, method:'drag_mouse_move'}); rcube_event.add_listener({event:'mousemove', object:this, method:'drag_mouse_move'});
rcube_event.add_listener({event:'mouseup', object:this, method:'drag_mouse_up'}); rcube_event.add_listener({event:'mouseup', object:this, method:'drag_mouse_up'});
if (bw.touch) { if (bw.touch) {
rcube_event.add_listener({event:'touchmove', object:this, method:'drag_mouse_move'}); rcube_event.add_listener({event:'touchmove', object:this, method:'drag_mouse_move'});
rcube_event.add_listener({event:'touchend', object:this, method:'drag_mouse_up'}); rcube_event.add_listener({event:'touchend', object:this, method:'drag_mouse_up'});
@ -649,6 +650,7 @@ drag_row: function(e, id)
// enable dragging over iframes // enable dragging over iframes
this.add_dragfix(); this.add_dragfix();
this.focus();
} }
return false; return false;
@ -1419,9 +1421,7 @@ highlight_children: function(id, status)
*/ */
key_press: function(e) key_press: function(e)
{ {
var target = e.target || {}; if (!this.focused || $(e.target).is('input,textarea,select'))
if (!this.focused || target.nodeName == 'INPUT' || target.nodeName == 'TEXTAREA' || target.nodeName == 'SELECT')
return true; return true;
var keyCode = rcube_event.get_keycode(e), var keyCode = rcube_event.get_keycode(e),

Loading…
Cancel
Save