From d5232f5b5a24efb1fa90a3f41ebd68d513661d6b Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 23 Jul 2015 12:04:49 +0200 Subject: [PATCH] Ensure that the viewer always receives focus when the HOME/END keys are pressed (bug 1186842) It appears that I broke this with PR 4941. Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1186842. --- web/viewer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/viewer.js b/web/viewer.js index fc6e8f3ba..9bbe8d878 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -1993,6 +1993,9 @@ window.addEventListener('keydown', function keydown(evt) { if (isViewerInPresentationMode || PDFViewerApplication.page > 1) { PDFViewerApplication.page = 1; handled = true; + if (!pdfViewer.containsElement(curElement)) { + pdfViewer.focus(); + } } break; case 35: // end @@ -2000,6 +2003,9 @@ window.addEventListener('keydown', function keydown(evt) { PDFViewerApplication.page < PDFViewerApplication.pagesCount)) { PDFViewerApplication.page = PDFViewerApplication.pagesCount; handled = true; + if (!pdfViewer.containsElement(curElement)) { + pdfViewer.focus(); + } } break;