phetsims / faradays-law

"Faraday's Law" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/faradays-law
GNU General Public License v3.0
1 stars 7 forks source link

Using Ctrl to switch tabs while magnet is selected with keyboard nav causes ghost magnet to appear #215

Closed loganbraywork closed 3 years ago

loganbraywork commented 3 years ago

Test device

Windows 10 HP Laptop

Operating System

Windows 10 1909

Browser

Chrome v. 87.0.4280.88 (Official Build) (64-bit)

Problem description

For https://github.com/phetsims/QA/issues/585

If the magnet is selected using keyboard navigation, and then ctrl+1, 2, or 3 is pressed, then web browsers such as chrome and firefox will switch tabs, creating a ghost magnet and ghost arrow in the sim which persists when magnet is moved. The magnet is not moved by the command ctrl+1, but visually acts as if 1 had just been pressed.

Steps to reproduce

  1. Open a new tab in the first space on your tab-bar
  2. Select the magnet using keyboard navigation
  3. Press ctrl+1 at the same time, so that the browser focuses on the first tab in your tab-bar
  4. Return to the sim and observe

Visuals 2020-12-17FaradayCtrlChromeGlitch

Troubleshooting information: !!!!! DO NOT EDIT !!!!! Name: ‪Faraday's Law‬ URL: https://phet-dev.colorado.edu/html/faradays-law/1.4.0-rc.2/phet/faradays-law_all_phet.html Version: 1.4.0-rc.2 2020-12-15 19:50:51 UTC Features missing: applicationcache, generatedcontent, applicationcache, touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Language: en-US Window: 1536x754 Pixel Ratio: 1.25/1 WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium) GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 30 uniform: 4096 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32) Max viewport: 32767x32767 OES_texture_float: true Dependencies JSON: {}

brooklynlash commented 3 years ago

I also noticed that the magnet will not move in keyboard nav unless you press the original number, i.e. if you pressed ctrl+1 it only moves when you press 1 a few times and will be stuck if you try to use 2 or 3.

jbphet commented 3 years ago

I did two things for this:

  1. added code to stop animation when magnet is release
  2. added a check for modifier keys and ignore the speed keys when present

Either of these would have fixed the root problem, but both together seem like a solid and more maintainable solution.

KatieWoe commented 3 years ago

Looks good on Win 10 Chrome and Firefox. Will reopen if something more comes up.