Skip to content

Commit

Permalink
Disable shortcuts when a <textarea> is focused
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Aug 16, 2023
1 parent 8913643 commit fdbe5d7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/helper/selection-tools/nudge-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class NudgeTool {
this.boundingBoxTool.isBitmap = mode in BitmapModes;
}
onKeyDown (event) {
if (event.event.target instanceof HTMLInputElement) {
if (event.event.target instanceof HTMLInputElement || event.event.target instanceof HTMLTextAreaElement) {
// Ignore nudge if a text input field is focused
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/helper/selection-tools/reshape-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class ReshapeTool extends paper.Tool {
this.active = false;
}
handleKeyDown (event) {
if (event.event.target instanceof HTMLInputElement) {
if (event.event.target instanceof HTMLInputElement || event.event.target instanceof HTMLTextAreaElement) {
// Ignore nudge if a text input field is focused
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/helper/tools/text-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class TextTool extends paper.Tool {
this.active = false;
}
handleKeyUp (event) {
if (event.event.target instanceof HTMLInputElement) {
if (event.event.target instanceof HTMLInputElement || event.event.target instanceof HTMLTextAreaElement) {
// Ignore nudge if a text input field is focused
return;
}
Expand All @@ -292,7 +292,7 @@ class TextTool extends paper.Tool {
}
}
handleKeyDown (event) {
if (event.event.target instanceof HTMLInputElement) {
if (event.event.target instanceof HTMLInputElement || event.event.target instanceof HTMLTextAreaElement) {
// Ignore nudge if a text input field is focused
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hocs/keyboard-shortcuts-hoc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const KeyboardShortcutsHOC = function (WrappedComponent) {
]);
}
handleKeyPress (event) {
if (event.target instanceof HTMLInputElement) {
if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) {
// Ignore keyboard shortcuts if a text input field is focused
return;
}
Expand Down

0 comments on commit fdbe5d7

Please sign in to comment.