Project

General

Profile

Bug #3962

To handle an application shortcut if there is a browser's default action assigned to the same shortcut

Added by Sergey Ivanovskiy about 5 years ago. Updated about 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:

History

#1 Updated by Sergey Ivanovskiy about 5 years ago

CTRL+F4 shortcut closes the current web tab in the browser. Thus there is an issue if the same shortcut is used by the converted application.
For Firefox the pinned tabs can help to handle this particular case if CTRL+F4 or CTRL+W keys are pressed.

https://support.mozilla.org/en-US/kb/pinned-tabs-keep-favorite-websites-open

#2 Updated by Greg Shah about 5 years ago

This is the list of Chrome shortcuts.

https://support.google.com/chrome/answer/157179?hl=en

I don't know which of these is treated in this "cannot be seen by javascript" manner.

#3 Updated by Sergey Ivanovskiy about 5 years ago

The web client is tried to disable all default actions except the COPY/CUT/PASTE but it doesn't work for some shortcuts.
In p2j.keyboard.js we define this private method permittedKeyStrokes of this GUIKeyboardReader class to check if a current keyboard event must be consumed or not

      /**
       * Tests if the keys strokes can invoke the permitted default actions: cut (shift + del,
       * ctrl + x), copy (ctrl + ins, ctrl + c) and paste (shift + ins, ctrl + v). For Safari,
       * pressing COMMAND + C, COMMAND + X and COMMAND + V can invoke the system clipboard copy,
       * cut and paste actions.
       * 
       * @param    {Event} evt
       *           The merged key stroke event that represents two pressed keys: a modifier and 
       *           a standard key.
       * 
       * @return   True if the keys strokes are from this set: shift + del, ctrl + x, ctrl+ins,
       *           ctrl + c, shift + ins and ctrl + v, otherwise false.
       */
      function permittedKeyStrokes(evt)
      {
         if (p2j.isSafari)
         {
            if (evt.metaKey &&
                (evt.keyCode === keys.X || evt.keyCode === keys.C || evt.keyCode === keys.V))
            {
               return true;
            }
         }
         else
         {
            if (evt.shiftKey && (evt.keyCode === keys.DELETE || evt.keyCode === keys.INSERT))
            {
               return true;
            }
            else if ((evt.ctrlKey && (evt.keyCode === keys.X || evt.keyCode === keys.C ||
                        evt.keyCode === keys.V || evt.keyCode === keys.INSERT)))
            {
               return true;
            }
         }

         return false;
      }

It seems that there is no another common way. For an example, for IE we use this code in p2j.js module

      if ("onhelp" in window)
      {
         // suppress the browser help window in IE
         window.onhelp = function ()
         {
            return false;
         }
      }

to suppress F1 default action.

#4 Updated by Sergey Ivanovskiy about 5 years ago

Another idea is to add a virtual keyboard in order to handle all these cases.

#5 Updated by Greg Shah about 5 years ago

I like the virtual keyboard idea. It is a universal "safety net". We can have a button that brings it up.

We may also want to provide a way to easily "alias" key sequences. For example, we can allow the customer to configure an alias so that some key sequence (e.g. SHIFT-F7) in the web client will generate a target key sequence (e.g. CTRL-F4) in FWD. The idea is that this is faster than bringing up the virtual keyboard. If the user can re-train themselves, it may be a workable solution.

Also available in: Atom PDF