Skip to content

Commit

Permalink
Check for focus on document as well as on textarea
Browse files Browse the repository at this point in the history
When clicking outside of the browser document area, the cursor does not
appear to get 'blurred'. This can be confusing as it implies that the
cursor is still active. This is caused by Terminal's isFocused getter
only checking if the textarea is the active element of the document.

Expand isFocused to also check that the document itself has focus.
  • Loading branch information
whydoubt committed Oct 23, 2018
1 parent b9ab35d commit 4d556fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
}

public get isFocused(): boolean {
return document.activeElement === this.textarea;
return document.activeElement === this.textarea && document.hasFocus();
}

/**
Expand Down

0 comments on commit 4d556fc

Please sign in to comment.