diff --git a/neath.js b/neath.js index 1bb7e7a..40f1d37 100644 --- a/neath.js +++ b/neath.js @@ -773,9 +773,16 @@ function setupInterface(data, file, urls) { if (editingTd) { - if (target == editingTd.elem) return; + if (target == $(':focus')) return; + if ($.contains($(':focus')[0], target)) return; + if ($.contains(target, $(':focus')[0])) return; + + let refocus = $(':focus'); + + editingTd.finish(true); + + refocus.focus(); - editingTd.finish(editingTd.elem, true); } if (!$.contains($('#table')[0], target)) return