Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3237 from matrix-org/bwindels/fixcpfocus
Browse files Browse the repository at this point in the history
Don't focus composer on keydown with modifier
  • Loading branch information
bwindels authored Jul 19, 2019
2 parents 4fa7302 + 77f5274 commit 3ee26b6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/structures/LoggedInView.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,12 @@ const LoggedInView = React.createClass({

let handled = false;
const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev);
const hasModifier = ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey;

switch (ev.keyCode) {
case KeyCode.PAGE_UP:
case KeyCode.PAGE_DOWN:
if (!ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {
if (!hasModifier) {
this._onScrollKeyPressed(ev);
handled = true;
}
Expand Down Expand Up @@ -369,7 +370,7 @@ const LoggedInView = React.createClass({
if (handled) {
ev.stopPropagation();
ev.preventDefault();
} else {
} else if (!hasModifier) {
const targetTag = ev.target.tagName;
const focusedOnInputControl = targetTag === "INPUT" ||
targetTag === "TEXTAREA" ||
Expand Down

0 comments on commit 3ee26b6

Please sign in to comment.