Skip to content

Conversation

@shaoboon
Copy link
Contributor

@shaoboon shaoboon commented Nov 19, 2025

PR Checklist

  • Unit Tests have been added for new changes
  • API tests have been updated if applicable
  • All commented code has been removed
  • If you've added a dependency, you've ensured license is compatible with Apache 2.0 and clearly outlined the added dependency.

What are you changing?

  • Added keyboard event listener in ngOnInit and handle the events in handleKeyboardEventCapture method
  • Added a new handleKeyboardEventCapture method to stop event propagation if the KVM session is active and if an input element has focus
  • Added event listener cleanup in ngOnDestroy() to prevent memory leaks
  • Added unit tests to verify the new functionality and ensure that keyboard events are properly handled when the KVM session is active

Anything the reviewer should know when reviewing this PR?

This is to resolve the #2591

The issue was reproduced in the main branch with the git commit ID: 696cd47

The solution fix was built on top of the above commit.

If the there are associated PRs in other repositories, please link them here (i.e. device-management-toolkit/repo#365 )

@shaoboon shaoboon force-pushed the issue2591/kbInputLockedInKVM branch 2 times, most recently from f71b49f to a73d15b Compare November 19, 2025 09:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes keyboard input locking in active KVM sessions by implementing event interception at the document level. The solution prevents the KVM toolkit from capturing keyboard events when users are typing in input fields, textareas, or other editable elements.

Key changes:

  • Implemented lifecycle hooks and keyboard event listeners to intercept events before KVM captures them
  • Added logic to detect focused input elements and stop event propagation when appropriate
  • Added comprehensive unit tests covering various input element types and scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/app/devices/kvm/kvm.component.ts Added keyboard event interception logic using capture phase listeners and cleanup in lifecycle hooks
src/app/devices/kvm/kvm.component.spec.ts Added comprehensive test suite verifying keyboard event handling across different input element types

- Added keyboard event listener in ngOnInit and handle the events in handleKeyboardEventCapture method
- Added a new handleKeyboardEventCapture method to stop event propagation if the KVM session is active and if an input element has focus
- Added event listener cleanup in ngOnDestroy() to prevent memory leaks
- Added unit tests to verify the new functionality and ensure that keyboard events are properly handled when the KVM session is active
@shaoboon shaoboon force-pushed the issue2591/kbInputLockedInKVM branch from a73d15b to 8eba757 Compare November 19, 2025 09:53
@shaoboon shaoboon requested a review from Copilot November 19, 2025 10:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

@shaoboon shaoboon requested a review from sudhir-intc November 20, 2025 07:03
Copy link
Contributor

@sudhir-intc sudhir-intc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the review comments from copilot. Apart from this w.r.t Angular code can't provide much feedback.
In the PR description please do mention the version of sample-ui through which you have reproduced this issue.

@shaoboon shaoboon merged commit 925b7b5 into main Nov 28, 2025
8 checks passed
@shaoboon shaoboon deleted the issue2591/kbInputLockedInKVM branch November 28, 2025 07:05
RosieAMT pushed a commit that referenced this pull request Nov 28, 2025
## [3.50.2](v3.50.1...v3.50.2) (2025-11-28)

### Bug Fixes

* prevent kb input lock in the active KVM session ([#2994](#2994)) ([925b7b5](925b7b5))
@RosieAMT
Copy link

🎉 This PR is included in version 3.50.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants