Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-755

Press minus key, '-', cannot enter editing mode in a cell under firefox

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 3.6.0
    • 2.6.0, 3.5.0
    • ZSS Component Client
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      1. visit http://zssdemo.zkoss.org/zssdemo/excel_like with firefox
      2. click a cell
      3. press minus key, "-", to enter a negative number

      Actual Result

      A cell doesn't enter editing mode.

      Expected Result

      A cell can enter editing mode under Chrome.

      Debug Information

      According to https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.keyCode
      minus key code value are different among Gecko (173) and chrome (189)

      Caused by SSheetCtrl.js isAsciiCharkey() return false, because 173 is not in _skey[].

      Using constant number is hard to debug, please consider turning them to readable var name.
      Maybe need a mechanism to handle cross-browser key code issue. According to reference doc above, KeyboardEvent.keyCode has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.

      Workaround

      <script><![CDATA[
      zk.afterLoad('zss', function () {
      var _oldMethod = {};
      zk.override(zss.SSheetCtrl.prototype, _oldMethod, {
      _doKeydown: function(evt) {
      _oldMethod._doKeydown.apply(this, arguments);
      var MINUS_GECKO = 173;
      if (evt.keyCode == MINUS_GECKO)

      { this._skipress = false; }

      }
      });
      });
      ]]></script>

            JerryChen JerryChen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: