From ee5d8ca56d2b450d5da711b33d1ede7408a83fc3 Mon Sep 17 00:00:00 2001 From: maxidirienzo Date: Mon, 9 Sep 2013 11:50:49 -0300 Subject: [PATCH] viewer.js: Do not process keyboard shortcuts when focused element is a textarea If focused element is a textarea, viewer should not process keyboard shortcuts (as it does with input and select elements) because while writing on a textarea, if you press k,p,l, or n, the viewer scrolls next/prev page and the letter is not added to the textarea (eg. in my case I had a viewer displaying a product specs in PDF and a "request a quote" form at it's right, the form had a textarea field and users complains that they couldn't write in it, after checking it, I've realized it was this particular issue and fixd it with the change I'm commiting. --- web/viewer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/web/viewer.js b/web/viewer.js index b4567deba..32215a5da 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -2692,6 +2692,7 @@ window.addEventListener('keydown', function keydown(evt) { // is selected. var curElement = document.activeElement || document.querySelector(':focus'); if (curElement && (curElement.tagName.toUpperCase() === 'INPUT' || + curElement.tagName.toUpperCase() === 'TEXTAREA' || curElement.tagName.toUpperCase() === 'SELECT')) { // Make sure that the secondary toolbar is closed when Escape is pressed. if (evt.keyCode !== 27) { // 'Esc'