简体   繁体   English

browserstack ctrl+enter 键盘事件未在 chrome 或 IE 中注册

[英]browserstack ctrl+enter keyboard event not registering in chrome or IE

I'm testing a feature on Browserstack and am unsure if it's really broken on Windows or if Browserstack is just not getting my keyboard events properly.我正在 Browserstack 上测试一项功能,但不确定它是否真的在 Windows 上损坏,或者 Browserstack 是否只是没有正确获取我的键盘事件。

I'm trying to detect when the user presses ctrl+enter.我正在尝试检测用户何时按下 ctrl+enter。 I have a code snippet below that works fine in Chrome on my MacBook.下面的代码片段在我的 MacBook 上的 Chrome 中运行良好。 However, when I use Browserstack to run it in Windows 10 with Chrome 87 (Latest), it does not register the correct keyboard event.但是,当我使用 Browserstack 在 Windows 10 和 Chrome 87(最新)中运行它时,它没有注册正确的键盘事件。

Steps to Reproduce重现步骤

  1. On a MacBook, go to www.browserstack.com在 MacBook 上,go 到www.browserstack.com
  2. Start a live session with this post as the url: https://stackoverflow.com/questions/65113392以 url 的身份开始直播 session: https://stackoverflow.com/questions/65113392
  3. Choose Windows 10 Chrome 87 (Latest)选择 Windows 10 Chrome 87(最新)
  4. Click the Run the code snippet button below inside Browserstack在 Browserstack 中单击下面的运行代码片段按钮
  5. Click on the input field单击输入字段
  6. Press ctrl+enter按 ctrl+enter

Expected behavior: I see "key: Enter, ctrlKey: true"预期行为:我看到“key: Enter, ctrlKey: true”

Observed behavior: I see "key: Control, ctrlKey: true"观察到的行为:我看到“key: Control, ctrlKey: true”

 const input = document.getElementById('input') const output = document.getElementById('output') input.addEventListener('keydown', (e) => { output.innerText = `key: ${e.key}, ctrlKey: ${e.ctrlKey}` })
 <input type="text" id="input" /> <div id="output"></div>

I spoke to Browerstack's customer service.我与 Browerstack 的客户服务部门进行了交谈。 They were able to confirm it's a bug in Browserstack.他们能够确认这是 Browserstack 中的错误。 I think it has to do with the way they switch cmd and ctrl keys.我认为这与他们切换 cmd 和 ctrl 键的方式有关。 In any case, it sounds like they aren't prioritizing the bug.无论如何,听起来他们并没有优先考虑错误。

If you're working on an app where you need to press ctrl+enter (eg to submit a comment so users can use the enter key for creating newlines), your best bet for testing is https://www.lambdatest.com .如果您正在开发需要按 ctrl+enter 的应用程序(例如,提交评论以便用户可以使用 enter 键创建换行符),那么您最好的测试选择是https://www.lambdatest.com I checked all the other major competitors and LambdaTest is the only one that has free live testing, although you do need to register for an account unlike with Browserstack.我检查了所有其他主要竞争对手,LambdaTest 是唯一提供免费实时测试的竞争对手,尽管与 Browserstack 不同,您确实需要注册一个帐户。 LambdaTest doesn't have this bug so I was able to test the feature there just fine. LambdaTest 没有这个错误,所以我能够在那里很好地测试该功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM