From 5ca2c6f510ed152d7ad568994ea824ec184e144d Mon Sep 17 00:00:00 2001 From: Bartek Szopka Date: Sat, 31 Dec 2011 10:53:01 +0100 Subject: [PATCH] trying to work around scrolling-on-focus bug, not impressive at all... --- js/impress.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/js/impress.js b/js/impress.js index 593a15c..a7dd565 100644 --- a/js/impress.js +++ b/js/impress.js @@ -1,4 +1,4 @@ -(function ( document ) { +(function ( document, window ) { // HELPER FUNCTIONS @@ -226,9 +226,20 @@ } }, false); + // Sometimes it's possible to trigger focus on first link with some keyboard action. + // Browser in such a case tries to scroll the page to make this element visible + // (even that body overflow is set to hidden) and it breaks our careful positioning. + // + // So, as a lousy (and lazy) workaround any scroll event will make the page scroll back to the top. + // + // If you are reading this and know any better way to handle it, I'll be glad to hear about it! + window.addEventListener("scroll", function ( event ) { + window.scrollTo(0, 0); + }, false); + // START // by selecting first step of presentation select(steps[0]); -})(document); +})(document, window);