Commit 3d61d8ee authored by david.bauer's avatar david.bauer 🔥 Committed by frank.paczynski
Browse files

Fixed: OXUIB-733 OX Webmail - After some Onclick action focus does not move

(cherry picked from commit 71c503e8)
parent 7b8ef60f
Pipeline #160887 passed with stages
in 50 minutes and 4 seconds
......@@ -120,17 +120,16 @@ define('io.ox/core/tk/flag-picker', [
},
change: function (e) {
e.preventDefault();
var data = e.data.data,
color = $(e.currentTarget).attr('data-color') || '0',
node = $(this).closest('.flag-picker');
color = $(e.currentTarget).attr('data-color') || '0';
data = folderAPI.ignoreSentItems(data);
api.changeColor(data, color);
node.find('.dropdown-toggle').focus();
api.changeColor(data, color).then(function () {
if (e.clientX && e.clientY) return;
$('.io-ox-mail-window:visible .list-item[tabindex="0"]').trigger('focus');
});
},
update: function (model) {
......
......@@ -74,6 +74,11 @@ define('io.ox/mail/actions', [
};
}
function setFocus(baton) {
if (baton.e.clientX && baton.e.clientY) return;
$('.io-ox-mail-window .list-item[tabindex="0"]').trigger('focus');
}
new Action('io.ox/mail/actions/reply', {
collection: 'some && toplevel',
matches: matchesReply,
......@@ -206,7 +211,7 @@ define('io.ox/mail/actions', [
return !_(baton.array()).every(util.isFlagged);
},
action: function (baton) {
api.flag(baton.data, true);
api.flag(baton.data, true).then(function () { setFocus(baton); });
}
});
......@@ -217,7 +222,7 @@ define('io.ox/mail/actions', [
return _(baton.array()).any(util.isFlagged);
},
action: function (baton) {
api.flag(baton.data, false);
api.flag(baton.data, false).then(function () { setFocus(baton); });
}
});
......@@ -229,14 +234,13 @@ define('io.ox/mail/actions', [
},
action: function (baton) {
var list = _.isArray(baton.data) ? baton.data : [baton.data];
api.archive(list);
api.archive(list).then(function () { setFocus(baton); });
}
});
new Action('io.ox/mail/actions/triggerFlags', {
collection: 'some',
action: function (baton) {
console.log(baton.e);
action: function () {
var dropDown = $('.dropdown.flag-picker').data();
$(document).trigger('click.bs.dropdown.data-api');
_.delay(function () {
......@@ -286,7 +290,7 @@ define('io.ox/mail/actions', [
action: function (baton) {
// we don't process sent items
var list = folderAPI.ignoreSentItems(baton.array());
api.markUnread(list);
api.markUnread(list).then(function () { setFocus(baton); });
}
});
......@@ -300,7 +304,7 @@ define('io.ox/mail/actions', [
action: function (baton) {
// we don't process sent items
var list = folderAPI.ignoreSentItems(baton.array());
api.markRead(list);
api.markRead(list).then(function () { setFocus(baton); });
}
});
......@@ -315,6 +319,7 @@ define('io.ox/mail/actions', [
.done(function (result) {
var error = _(result).chain().pluck('error').compact().first().value();
if (error) notifications.yell(error);
setFocus(baton);
})
.fail(function (error) {
notifications.yell(error);
......@@ -346,6 +351,7 @@ define('io.ox/mail/actions', [
api.noSpam(baton.array()).done(function (result) {
var error = _(result).chain().pluck('error').compact().first().value();
if (error) notifications.yell(error);
setFocus(baton);
});
}
});
......
......@@ -93,6 +93,11 @@ define('io.ox/mail/actions/delete', [
})();
function setFocus(baton) {
if (baton.e.clientX && baton.e.clientY) return;
$('.io-ox-mail-window .list-item[tabindex="0"]').trigger('focus');
}
return function (baton) {
var list = folderAPI.ignoreSentItems(baton.array()),
all = list.slice(),
......@@ -110,7 +115,9 @@ define('io.ox/mail/actions/delete', [
new ModalDialog({ title: gt('Delete mail'), description: getQuestion(list) })
.addCancelButton()
.addButton({ label: gt('Delete'), action: 'delete' })
.on('delete', function () { api.remove(list, all).fail(notifications.yell); })
.on('delete', function () {
api.remove(list, all).fail(notifications.yell).then(function () { setFocus(baton); });
})
// trigger back event, used for mobile swipe delete reset
.on('cancel', function () { ox.trigger('delete:canceled', list); })
.open();
......@@ -120,7 +127,7 @@ define('io.ox/mail/actions/delete', [
// mail quota exceeded? see above
if (e.code === 'MSG-0039') return;
notifications.yell(e);
});
}).then(function () { setFocus(baton); });
}
}, function cancel() {
ox.trigger('delete:canceled', all);
......
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