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.
This commit is contained in:
maxidirienzo 2013-09-09 11:50:49 -03:00
parent 494008eca0
commit ee5d8ca56d

View File

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