Details
-
Bug
-
Resolution: Fixed
-
Normal
-
2.6.0, 3.5.0
-
Security Level: Jimmy
-
None
Description
Steps to Reproduce
- visit http://zssdemo.zkoss.org/zssdemo/excel_like with firefox
- click a cell
- 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)
}
});
});
]]></script>