Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(modifier key): reset modifier keys when browser tab loses focus/is hidden #759

Conversation

jbocce
Copy link
Contributor

@jbocce jbocce commented Aug 29, 2023

Context

Fixes #733.

Changes & Results

In packages\tools\src\eventListeners\keyboard\keyDownListener.ts, reset the modifier key whenever the browser tab is 'hidden' (i.e. loses focus). Prior to this PR, the modifier key for changing tab (e.g. Ctrl) or app (e.g. Alt) focus would remain in the modifier key state and was never cleared until a subsequent key-up event.

Testing

First and foremost, ensure issue #733 is resolved.

Test A:

  1. Run the doubleClickWithStackAnnotationTools example.
  2. Add various annotations.
  3. Either Ctrl-tab or Alt-tab to change the tab/app focus.
  4. In the destination app/window/tab perform some mouse clicks/wheels and/or key strokes.
  5. Return to the tab running the example.
  6. One should still be able to add and edit annotations.

Test B:

  1. Run the modifierkeys example.
  2. Exercise the various aspects of the example.
  3. Either Ctrl-tab or Alt-tab to change the tab/app focus.
  4. In the destination window/tab perform some mouse clicks/wheels and/or key strokes.
  5. Return to the tab running the example.
  6. The example should continue to behave as before.

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • "OS: Windows 11
  • "Node version: 16.14.0
  • "Browser: Chrome 116.0.5845.111

@netlify
Copy link

netlify bot commented Aug 29, 2023

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit 33c2d09
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/64edfbd2a2a4a80008f54daa
😎 Deploy Preview https://deploy-preview-759--cornerstone-3d-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sedghi sedghi merged commit 2602ec6 into cornerstonejs:main Aug 30, 2023
10 checks passed
@jbocce jbocce deleted the fix/CS3D-733-reset-modifier-keys-when-tab-loses-focus branch August 31, 2023 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants