Skip to content

Commit

Permalink
fix: fix global keyboard event is invalid in some case (#2301)
Browse files Browse the repository at this point in the history
Closes: #2300

Co-authored-by: MrMengJ <[email protected]>
  • Loading branch information
MrMengJ and MrMengJ authored Jul 5, 2022
1 parent 1f5d5d1 commit 0454995
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/x6/src/graph/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,13 @@ export class Keyboard extends Disposable implements IDisablable {

protected isGraphEvent(e: KeyboardEvent) {
const target = (e.srcElement || e.target) as Element
const currentTarget = e.currentTarget as Element
if (target) {
if (target === this.target || target === document.body) {
if (
target === this.target ||
currentTarget === this.target ||
target === document.body
) {
return true
}

Expand Down

0 comments on commit 0454995

Please sign in to comment.