texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: js/info.js: Use keydown event handler instead of


From: Per Bothner
Subject: branch master updated: js/info.js: Use keydown event handler instead of keyup.
Date: Tue, 04 May 2021 09:09:18 -0400

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

bothner pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new ef32aab  js/info.js: Use keydown event handler instead of keyup.
ef32aab is described below

commit ef32aabdf7cc3b934b0e1619bad0570edb75e694
Author: Per Bothner <per@bothner.com>
AuthorDate: Tue May 4 06:08:53 2021 -0700

    js/info.js: Use keydown event handler instead of keyup.
    
    The former is more standard.
---
 ChangeLog  |  5 +++++
 js/info.js | 16 ++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c28aa95..a78f339 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-04  Per Bothner  <per@bothner.com>
+
+       * js/info.js: Use keydown event handler instead of keyup.
+       The former is more standard.
+
 2021-05-02  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_convert_image_command): format
diff --git a/js/info.js b/js/info.js
index 94d0220..3e311e2 100644
--- a/js/info.js
+++ b/js/info.js
@@ -513,7 +513,7 @@
 
       /* Define a special key handler when 'this.input' is focused and
          visible.*/
-      this.input.addEventListener ("keyup", (function (event) {
+      this.input.addEventListener ("keydown", (function (event) {
         if (is_escape_key (event.key))
           store.dispatch ({ type: "unfocus" });
         else if (event.key === "Enter")
@@ -561,7 +561,7 @@
 
       /* Define a special key handler when 'this.input' is focused and
          visible.*/
-      this.input.addEventListener ("keyup", (function (event) {
+      this.input.addEventListener ("keydown", (function (event) {
         if (is_escape_key (event.key))
           store.dispatch ({ type: "unfocus" });
         else if (event.key === "Enter")
@@ -1547,16 +1547,16 @@
     }
   }
 
-  /** Handle Keyboard 'keyup' events.
+  /** Handle Keyboard 'keydown' events.
       @arg {KeyboardEvent} event */
   function
-  on_keyup (event)
+  on_keydown (event)
   {
     if (is_escape_key (event.key))
       store.dispatch ({ type: "unfocus" });
     else
       {
-        var val = on_keyup.dict[event.key];
+        var val = on_keydown.dict[event.key];
         if (val)
           {
             if (typeof val === "function")
@@ -1568,7 +1568,7 @@
   }
 
   /* Associate an Event 'key' property to an action or a thunk.  */
-  on_keyup.dict = {
+  on_keydown.dict = {
     i: actions.show_text_input ("index"),
     l: window.history.back.bind (window.history),
     m: actions.show_text_input ("menu"),
@@ -2170,8 +2170,8 @@
   /* Register common event handlers.  */
   window.addEventListener ("beforeunload", on_unload, false);
   window.addEventListener ("click", on_click, false);
-  /* XXX: handle 'keyup' event instead of 'keypress' since Chromium
+  /* XXX: handle 'keydown' event instead of 'keypress' since Chromium
      doesn't handle the 'Escape' key properly.  See
      https://bugs.chromium.org/p/chromium/issues/detail?id=9061.  */
-  window.addEventListener ("keyup", on_keyup, false);
+  window.addEventListener ("keydown", on_keydown, false);
 } (window["Modernizr"], window["INFO_CONFIG"]));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]