JavaScript键事件“流程”

时间:2018-09-07 03:52:09

标签: javascript google-chrome keyevent chinese-locale html5-input-date

仅在Google Chrome上发生此问题。首先,我在文本字段上键入了Chinese character,然后转到date input字段(无论我是用鼠标单击还是Tab键输入日期),然后按数字键输入日期-但它只指向原始文本字段本身,并在文本字段中发短信。

抱歉,我无法用有限的语言清楚地描述它。但是我做了一个screen capture

我尝试在按下数字键时监听按键事件,它向我显示一个按键为Process的事件。与这种情况有关系吗?我查了一下,这似乎是流程处理的关键事件,当我添加event.preventDefault();时什么也没发生(一切仍然与screen capture所示的一样。)

关键事件:

{
  altKey: false,
  bubbles: true,
  cancelBubble: false,
  cancelable: true,
  charCode: 0,
  code: "Numpad2",
  composed: true,
  ctrlKey: false,
  currentTarget: null,
  defaultPrevented: true,
  detail: 0,
  eventPhase: 0,
  isComposing: false,
  isTrusted: true,
  key: "Process",
  keyCode: 229,
  location: 3,
  metaKey: false,
  repeat: false,
  returnValue: false,
  shiftKey: false,
  type: "keydown",
  which: 229
}

我的环境:

  • 角度6
  • Google Chrome 69.0.3497.81(Firefox不会出现)
  • 中文语言环境(如果我在文本字段中键入英语或数字,则不会发生

感谢您花时间阅读和尝试提供帮助!

0 个答案:

没有答案