Skip to content

Commit

Permalink
fix(element-selection): disable keyboard control when input something
Browse files Browse the repository at this point in the history
fix #1192
  • Loading branch information
fengyuanchen committed Aug 18, 2024
1 parent 1a290d5 commit af97972
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/element-selection/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,16 @@ export default class CropperSelection extends CropperElement {
return;
}

const { activeElement } = document;

// Disable keyboard control when input something
if (activeElement && (
['INPUT', 'TEXTAREA'].includes(activeElement.tagName)
|| ['true', 'plaintext-only'].includes((activeElement as HTMLElement).contentEditable)
)) {
return;
}

switch ((event as KeyboardEvent).key) {
case 'Backspace':
if ((event as KeyboardEvent).metaKey) {
Expand Down

0 comments on commit af97972

Please sign in to comment.