We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 089ab9e commit 0910b21Copy full SHA for 0910b21
src/Keyboard.ml
@@ -18,10 +18,18 @@ let key_of_string = function
18
| _ -> None
19
;;
20
21
-(* TODO: Ignore key when ctrl or cmd are pressed *)
22
let decode_event =
23
let open Tea.Json in
24
- Decoder.field "key" Decoder.string |> Decoder.map key_of_string
+ (* Ignore key if any of alt/ctrl/meta are pressed *)
+ let ignore_modifier_keys key alt ctrl meta =
25
+ if alt || ctrl || meta then None else key_of_string key
26
+ in
27
+ Decoder.map4
28
+ ignore_modifier_keys
29
+ (Decoder.field "key" Decoder.string)
30
+ (Decoder.field "altKey" Decoder.bool)
31
+ (Decoder.field "ctrlKey" Decoder.bool)
32
+ (Decoder.field "metaKey" Decoder.bool)
33
34
35
let pressed =
0 commit comments