mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-30 00:50:48 +08:00
Don't trigger keyboard shortcuts if modifiers are held
None of these keyboard shortcuts expect modifier keys, so they should in fact expect the absence of modifiers.
This commit is contained in:
parent
13887a8943
commit
51e4a3b14b
@ -93,6 +93,16 @@ test("reactions can be sent via keyboard presses", async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("reaction is not sent when modifier key is held", async () => {
|
||||||
|
const user = userEvent.setup();
|
||||||
|
|
||||||
|
const sendReaction = vi.fn();
|
||||||
|
render(<TestComponent sendReaction={sendReaction} />);
|
||||||
|
|
||||||
|
await user.keyboard("{Meta>}1{/Meta}");
|
||||||
|
expect(sendReaction).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
test("raised hand can be sent via keyboard presses", async () => {
|
test("raised hand can be sent via keyboard presses", async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ export function useCallViewKeyboardShortcuts(
|
|||||||
(event: KeyboardEvent) => {
|
(event: KeyboardEvent) => {
|
||||||
if (focusElement.current === null) return;
|
if (focusElement.current === null) return;
|
||||||
if (!mayReceiveKeyEvents(focusElement.current)) return;
|
if (!mayReceiveKeyEvents(focusElement.current)) return;
|
||||||
|
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
||||||
|
return;
|
||||||
|
|
||||||
if (event.key === "m") {
|
if (event.key === "m") {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
Loading…
Reference in New Issue
Block a user