[Pkg-javascript-commits] [pdf.js] 26/204: Handtool: Remove focus from previous node on click

David Prévot taffit at moszumanska.debian.org
Sat Oct 25 18:50:26 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 204d540af29536a2aee9b3758ce020df41902f00
Author: Rob Wu <rob at robwu.nl>
Date:   Wed Sep 3 16:20:41 2014 +0200

    Handtool: Remove focus from previous node on click
    
    "This commit fixes the issue that a focused element cannot lose
    focus when the draggable element is clicked."
    https://github.com/Rob--W/grab-to-pan.js/commit/11c368f97cebe19
    
    Steps to reproduce/verify:
    1. Enable the hand tool (e.g. by using the H shortcut)
    2. Click on the Page number input.
    3. Click or drag the PDF canvas.
    4. Observe that the page number input is still focused.
       Consequently, the hand tool cannot be disabled using the H shortcut.
---
 web/grab_to_pan.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/web/grab_to_pan.js b/web/grab_to_pan.js
index a391734..e50a6bc 100644
--- a/web/grab_to_pan.js
+++ b/web/grab_to_pan.js
@@ -135,6 +135,11 @@ var GrabToPan = (function GrabToPanClosure() {
       event.preventDefault();
       event.stopPropagation();
       this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);
+
+      var focusedElement = document.activeElement;
+      if (focusedElement && !focusedElement.contains(event.target)) {
+        focusedElement.blur();
+      }
     },
 
     /**

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list