diff --git a/js/dom.js b/js/dom.js index 7e218853..e5502ba4 100644 --- a/js/dom.js +++ b/js/dom.js @@ -89,7 +89,7 @@ function onDOMready() { } -function scrollElementIntoView(element, {invalidMarginRatio = .25} = {}) { +function scrollElementIntoView(element, {invalidMarginRatio = 0} = {}) { // align to the top/bottom of the visible area if wasn't visible const {top, height} = element.getBoundingClientRect(); const {top: parentTop, bottom: parentBottom} = element.parentNode.getBoundingClientRect(); diff --git a/manage/incremental-search.js b/manage/incremental-search.js index 45354152..4f61ff6e 100644 --- a/manage/incremental-search.js +++ b/manage/incremental-search.js @@ -64,7 +64,7 @@ onDOMready().then(() => { focusedEntry = found; focusedLink = $('.style-name-link', found); focusedName = found.styleNameLowerCase; - scrollElementIntoView(found); + scrollElementIntoView(found, {invalidMarginRatio: .25}); animateElement(found, {className: 'highlight-quick'}); resizeTo(focusedLink); return true; diff --git a/manage/manage.js b/manage/manage.js index 9d53d3e5..230e14a4 100644 --- a/manage/manage.js +++ b/manage/manage.js @@ -406,7 +406,7 @@ function handleUpdate(style, {reason, method} = {}) { filterAndAppend({entry}); if (!entry.matches('.hidden') && reason !== 'import') { animateElement(entry); - scrollElementIntoView(entry, {invalidMarginRatio: 0}); + scrollElementIntoView(entry); } function handleToggledOrCodeOnly() {