focus the composer in the body keydown handler if not other shortcuts apply
this allows the user to start typing a message even if the composer is not focused.
This commit is contained in:
parent
380639516b
commit
4adea67eb3
1 changed files with 16 additions and 0 deletions
|
@ -333,6 +333,22 @@ const LoggedInView = React.createClass({
|
||||||
if (handled) {
|
if (handled) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
} else {
|
||||||
|
const targetTag = ev.target.tagName;
|
||||||
|
const focusedOnInputControl = targetTag === "INPUT" ||
|
||||||
|
targetTag === "TEXTAREA" ||
|
||||||
|
targetTag === "SELECT" ||
|
||||||
|
ev.target.getAttribute("contenteditable");
|
||||||
|
// we don't check for buttons that have focus here,
|
||||||
|
// because they should be using AccessibleButton which
|
||||||
|
// calls stopPropagation on space or enter keydown, so
|
||||||
|
// that keydown event would never get here.
|
||||||
|
if (!focusedOnInputControl) {
|
||||||
|
dis.dispatch({action: 'focus_composer'}, true);
|
||||||
|
ev.stopPropagation();
|
||||||
|
// we should *not* preventDefault() here as
|
||||||
|
// that would prevent typing in the now-focussed composer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue