Skip to content

Conversation

@sreya
Copy link
Contributor

@sreya sreya commented Nov 18, 2025

No description provided.

Previously, when users highlighted text and clicked outside the terminal
canvas (e.g., on the page background), the selection would persist
indefinitely. This was confusing as there was no visual feedback that
the selection was still active.

This fix adds a document-level click event listener that detects clicks
outside the canvas and automatically clears the selection. The listener
is properly cleaned up in the dispose() method to prevent memory leaks.

Changes:
- Added boundClickHandler to track document click listener
- Implemented click-outside detection using canvas.contains()
- Added proper cleanup in dispose() method
- Added test case for click-outside behavior

The fix maintains the existing behavior where clicking ON the canvas
starts a new selection (which already cleared the previous selection).
@sreya sreya merged commit 5d9e68c into main Nov 18, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant