diff --git a/web/viewer.js b/web/viewer.js index b63eb9d02..0c14271ec 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -2270,29 +2270,6 @@ window.addEventListener('keydown', function keydown(evt) { PDFView.rotatePages(90); break; } - if (!handled && !PresentationMode.active) { - // 33=Page Up 34=Page Down 35=End 36=Home - // 37=Left 38=Up 39=Right 40=Down - if (evt.keyCode >= 33 && evt.keyCode <= 40 && - !PDFView.container.contains(curElement)) { - // The page container is not focused, but a page navigation key has been - // pressed. Change the focus to the viewer container to make sure that - // navigation by keyboard works as expected. - PDFView.container.focus(); - } - // 32=Spacebar - if (evt.keyCode === 32 && curElementTagName !== 'BUTTON') { -//#if (FIREFOX || MOZCENTRAL) -//// Workaround for issue in Firefox, that prevents scroll keys from working -//// when elements with 'tabindex' are focused. (#3499) -// PDFView.container.blur(); -//#else - if (!PDFView.container.contains(curElement)) { - PDFView.container.focus(); - } -//#endif - } - } } if (cmd === 4) { // shift-key @@ -2312,6 +2289,30 @@ window.addEventListener('keydown', function keydown(evt) { } } + if (!handled && !PresentationMode.active) { + // 33=Page Up 34=Page Down 35=End 36=Home + // 37=Left 38=Up 39=Right 40=Down + if (evt.keyCode >= 33 && evt.keyCode <= 40 && + !PDFView.container.contains(curElement)) { + // The page container is not focused, but a page navigation key has been + // pressed. Change the focus to the viewer container to make sure that + // navigation by keyboard works as expected. + PDFView.container.focus(); + } + // 32=Spacebar + if (evt.keyCode === 32 && curElementTagName !== 'BUTTON') { +//#if (FIREFOX || MOZCENTRAL) +// // Workaround for issue in Firefox, that prevents scroll keys from +// // working when elements with 'tabindex' are focused. (#3498) +// PDFView.container.blur(); +//#else + if (!PDFView.container.contains(curElement)) { + PDFView.container.focus(); + } +//#endif + } + } + if (cmd === 2) { // alt-key switch (evt.keyCode) { case 37: // left arrow