[FIX] web: IE Edge focus bug when delete in list

In the following situation :

 we click on an element inside a row (not the last row) which will:
 -> open an alert, confirm or prompt dialog
 -> remove the row containing the element

IE Edge would enter in a odd state where the focus is not given back to
the page, and clicking doesn't work anymore.

This fix solves this by detecting this situation and then focusing on an
input field which make IE Edge stop being crazy.

opw-653282

jsfiddle showing the issue: http://jsfiddle.net/ts8bsLLg/4/
jsfiddle showing a solution: http://jsfiddle.net/ts8bsLLg/6/

bug report on microsoft:
https://connect.microsoft.com/IE/feedbackdetail/view/1988284

note: applied in 9.0 community, 9.0 enterprise
This commit is contained in:
Nicolas Lempereur
2015-11-06 15:48:10 +01:00
parent 8a05e585d8
commit 157ce1b6e3
@@ -1068,6 +1068,10 @@ ListView.List = Class.extend( /** @lends instance.web.ListView.List# */{
e.stopPropagation();
var $row = $(e.target).closest('tr');
$(self).trigger('deleted', [[self.row_id($row)]]);
// IE Edge go crazy when we use confirm dialog and remove the focused element
if(document.hasFocus && !document.hasFocus()) {
$('<input />').appendTo('body').focus().remove();
}
})
.delegate('td.oe_list_field_cell button', 'click', function (e) {
e.stopPropagation();