components/composer: focus composer on keydown if a link is active

Fixes message not typed after clicking on a link.
This commit is contained in:
Simon Ser 2023-01-31 18:28:51 +01:00
parent c6024e643a
commit f7459704f6

View File

@ -118,8 +118,14 @@ export default class Composer extends Component {
handleWindowKeyDown(event) {
// If an <input> or <button> is focused, ignore.
if (document.activeElement !== document.body && document.activeElement.tagName !== "SECTION") {
return;
if (document.activeElement && document.activeElement !== document.body) {
switch (document.activeElement.tagName.toLowerCase()) {
case "section":
case "a":
break;
default:
return;
}
}
// If a modifier is pressed, reserve for key bindings.