mirror of
https://codeberg.org/emersion/gamja
synced 2025-03-13 07:48:37 +01:00
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:
parent
c6024e643a
commit
f7459704f6
@ -118,9 +118,15 @@ export default class Composer extends Component {
|
|||||||
|
|
||||||
handleWindowKeyDown(event) {
|
handleWindowKeyDown(event) {
|
||||||
// If an <input> or <button> is focused, ignore.
|
// If an <input> or <button> is focused, ignore.
|
||||||
if (document.activeElement !== document.body && document.activeElement.tagName !== "SECTION") {
|
if (document.activeElement && document.activeElement !== document.body) {
|
||||||
|
switch (document.activeElement.tagName.toLowerCase()) {
|
||||||
|
case "section":
|
||||||
|
case "a":
|
||||||
|
break;
|
||||||
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If a modifier is pressed, reserve for key bindings.
|
// If a modifier is pressed, reserve for key bindings.
|
||||||
if (event.altKey || event.ctrlKey || event.metaKey) {
|
if (event.altKey || event.ctrlKey || event.metaKey) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user