Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-3714

Search fields should not block keyboard events

    Details

    • Type: Bug
    • Status: Closed
    • Priority: TBD
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Complexity:
      Low

      Description

      Our input search fields stops propagation of keyup event for some special keys (for example, Command key on Mac or Ctrl on PC, but they should not do this.

      This happens because inside openmrsSearch.js we have .keyup() handler for search field, which explicity stops event propagation in case of Windows (kc = 17, lines 251, 263-265 of that file):

      ....
      var kc = event.keyCode;
      ....
      //ignore the following keys SHIFT(16), ESC(27), CAPSLOCK(20), CTRL(17), ALT(18), SPACE(32), ALT_TAB(9)
      else if((kc >= 16 && kc <= 18) || kc == 20 || kc == 27 || kc == 32 || kc == 9)
      	return false;
      ....
      

      in case of Mac (kc = 91, lines 277-285):

      ....
      if(text == '' && !self.options.doSearchWhenEmpty){
          $j('#pageInfo').css("visibility", "hidden");
      	$j("#spinner").css("visibility", "hidden");
      	$j("#minCharError").css("visibility", "hidden");
      	$j(".openmrsSearchDiv").hide();
      	loadingMsgObj.html("");
      						
          	return false;
          }
      ....
      

      The fix seems to be pretty simple. Actually it's only 2 lines. All that's need is to change return false; to return true; within openmrsSearch.js inside snapshots given above.

        Gliffy Diagrams

          Attachments

            Attachments-Category-Modification

              Activity

                People

                • Assignee:
                  kushal Kushal Sunerha
                  Reporter:
                  mvorobey Mykola Vorobey
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - 30 minutes
                    30m
                    Remaining:
                    Remaining Estimate - 30 minutes
                    30m
                    Logged:
                    Time Spent - Not Specified
                    Not Specified