focus: scroll to active element
[kivitendo-erp.git] / js / common.js
index e19f7f2..84e0b26 100644 (file)
@@ -235,6 +235,10 @@ $(function () {
       }
     }
 
+    // scroll to the active element. jQuery.focus doesn't do this
+    // TODO: find out how to reliably frame the active element
+    window.scrollTo(0, document.activeElement.getBoundingClientRect().top);
+
     // legacy. sone forms install these
     if (typeof fokus == 'function') { fokus(); return; }
     if (focus_by_name('cursor_fokus')) return;