Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-2590

Type numpad 1 but combobox selects an item starting with 'A'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 7.0.4
    • Fix Version/s: 7.0.5
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None

      Description

      Steps to Reproduce

      1. run the zul
        	<combobox width="150px" readonly="true" >
        			<comboitem label="A1" value="A1" />
        			<comboitem label="B1" value="B1" />
        			<comboitem label="C1" value="C1" />
        			<comboitem label="1A" value="1A" />
        			<comboitem label="2A" value="2A" />
        	</combobox>
        
      2. click the drop-down arrow to open Comboitem list
      3. press 1 on numbpad

      Actual Result

      Combobox selects the item "A1".

      Expected Result

      Combobox should select the item "1A".

      Debug Information

      In Combobox widget, otherPressed_(), String.fromCharCode(keyCode), keyCode of numpad 1 is 97 which is converted to char 'a'.

      According to the conclusion of http://unixpapa.com/js/key.html

      On keydown and keyup events, the keycodes are not character codes, and this conversion will give wild results for many keys. There is no general portable way to convert keycodes to characters

      We should not convert keydown event's keycode into a string. The keypress event's which is suggested.
      http://www.w3.org/2002/09/tests/keys.html demonstrates keycode difference.

        Attachments

          Activity

            People

            Assignee:
            ChunfuChang ChunfuChang
            Reporter:
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: