Skip to content

Commit ee5d8ca

Browse files
committed
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.
1 parent 494008e commit ee5d8ca

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

web/viewer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,6 +2692,7 @@ window.addEventListener('keydown', function keydown(evt) {
26922692
// is selected.
26932693
var curElement = document.activeElement || document.querySelector(':focus');
26942694
if (curElement && (curElement.tagName.toUpperCase() === 'INPUT' ||
2695+
curElement.tagName.toUpperCase() === 'TEXTAREA' ||
26952696
curElement.tagName.toUpperCase() === 'SELECT')) {
26962697
// Make sure that the secondary toolbar is closed when Escape is pressed.
26972698
if (evt.keyCode !== 27) { // 'Esc'

0 commit comments

Comments
 (0)