如何防止上下文菜单显示在 Chrome 的设备视图中

How to prevent context menu from showing in Chrome's device view

我有一个 <input> onFocus 正在 select 编辑文本:

onFocusHandler = (event) => {
  event.currentTarget.select()
}

这在 Chrome 中工作正常,但是当我在 "Device" 模式下查看它时,每次文本被 selected 时,上下文菜单显示 "Look up <selected text>" 在顶部。 select 不会这样做的文本有不同的方法吗?

根据 Сергей Петрашко 的评论,我试了一下:

<Input
  type="number"
  value={value || ''}
  onChange={this.onChangeHandler}
  onFocus={this.onFocusHandler}
  onContextMenu={e => e.preventDefault()}
  onUnfocusHandler={this.onUnfocusHandler}
/>

这会阻止显示上下文菜单。我还发现仅使用 onClick 到 select 文本也不显示上下文菜单(不阻止 onContextMenu 事件)。