Fix scrolling using Shift+Spacebar in Firefox

This commit is contained in:
Jonas Jenwald 2014-02-27 13:33:35 +01:00
parent 33a9582584
commit 6fd0b063e9

View File

@ -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