diff --git a/aqt/editor.py b/aqt/editor.py index bf23e6ba1..a00c46af0 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -97,7 +97,11 @@ function onFocus(elem) { } while (obj = obj.offsetParent); return cur; } - window.scroll(0,pos(elem)-15); + var y = pos(elem); + if ((window.pageYOffset+window.innerHeight) < (y+elem.offsetHeight)) + window.scroll(0,y+elem.offsetHeight-window.innerHeight); + else if (window.pageYOffset > y) + window.scroll(0, y-15); } // restore cursor