Fix shortcuts on non QWERTY keyboards (#715)

* Use key instead of keyCode or code

* Use key for Escape
This commit is contained in:
ginnyTheCat
2022-08-05 15:42:25 +02:00
committed by GitHub
parent 1d90f7588b
commit 5e527e434a
4 changed files with 10 additions and 12 deletions

View File

@@ -256,11 +256,11 @@ function RoomViewCmdBar({ roomId, roomTimeline, viewEvent }) {
function listenKeyboard(event) {
const { activeElement } = document;
const lastCmdItem = document.activeElement.parentNode.lastElementChild;
if (event.keyCode === 27) {
if (event.key === 'Escape') {
if (activeElement.className !== 'cmd-item') return;
viewEvent.emit('focus_msg_input');
}
if (event.keyCode === 9) {
if (event.key === 'Tab') {
if (lastCmdItem.className !== 'cmd-item') return;
if (lastCmdItem !== activeElement) return;
if (event.shiftKey) return;