Reset modifier button's state
Description
Fixes https://github.com/apache/cloudstack/issues/9940
Copilot Generated summary
This pull request enhances the reliability of modifier key handling in the noVNC UI, especially for VMware VMs using a websocket reverse proxy. It introduces logic to ensure all pressed modifier keys are released when the user closes the browser tab or navigates away, preventing stuck keys on the remote VM. The changes are grouped into modifier key management and event handling improvements.
Modifier key management:
- Added a
_modifierKeysconfiguration object to track modifier keys (Shift, Ctrl, Alt, Windows) and their associated keysyms, codes, and button IDs in theUIobject. - Implemented
_sendKeyUp,_releaseModifierKey, and_releaseAllModifierKeysmethods to send key release events for individual or all modifier keys, updating UI state accordingly.
Event handling improvements:
- Registered
beforeunloadandpagehideevent listeners to trigger modifier key release logic when the user closes the tab or navigates away, ensuring the remote VM does not retain stuck modifier keys. - Added
handleBeforeUnloadandhandlePageHidemethods to execute modifier key release logic on relevant browser events.
Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
- [ ] Build/CI
- [ ] Test (unit or integration test code)
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
- [ ] Major
- [ ] Minor
Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [ ] Minor
- [ ] Trivial
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 17.56%. Comparing base (4379666) to head (e05b970).
:warning: Report is 5 commits behind head on 4.22.
Additional details and impacted files
@@ Coverage Diff @@
## 4.22 #12187 +/- ##
============================================
+ Coverage 3.58% 17.56% +13.97%
- Complexity 0 15548 +15548
============================================
Files 445 5910 +5465
Lines 37536 529129 +491593
Branches 6905 64634 +57729
============================================
+ Hits 1346 92939 +91593
- Misses 36024 425732 +389708
- Partials 166 10458 +10292
| Flag | Coverage Δ | |
|---|---|---|
| uitests | 3.58% <ø> (ø) |
|
| unittests | 18.63% <ø> (?) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@blueorangutan package
@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15916
clgtm, one question.
also tested ok in lab env