From 747c4c4b3d7862d5c6889438b96bd7ad408b24bc Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 24 Oct 2012 21:30:52 -0400 Subject: fix keyboard navigation in ie9 (closes #202) --- js/reveal.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'js/reveal.js') diff --git a/js/reveal.js b/js/reveal.js index cb0205e..fcc064d 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1088,9 +1088,14 @@ var Reveal = (function(){ * @param {Object} event */ function onDocumentKeyDown( event ) { - // Disregard the event if the target is editable or a - // modifier is present - if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; + // Check if there's a focused element that could be using + // the keyboard + var activeElement = document.activeElement; + var hasFocus = !!( document.activeElement && ( document.activeElement.type || document.activeElement.href || document.activeElement.contentEditable !== 'inherit' ) ); + + // Disregard the event if there's a focused element or a + // keyboard modifier key is present + if ( hasFocus || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; var triggered = true; -- cgit v1.2.3