# handleDOMEvents.keypress doesn't fire

**URL:** https://discuss.prosemirror.net/t/handledomevents-keypress-doesnt-fire/6274
**Category:** Uncategorized
**Created:** [March 13, 2024, 11:13pm UTC](https://discuss.prosemirror.net/t/handledomevents-keypress-doesnt-fire/6274 "2024-03-13T23:13:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![prosed](https://discuss.prosemirror.net/letter_avatar_proxy/v4/letter/p/aeb1de/32.png) [@prosed](https://discuss.prosemirror.net/u/prosed)
#### Post date: [March 13, 2024, 11:13pm UTC](https://discuss.prosemirror.net/t/handledomevents-keypress-doesnt-fire/6274/1 "2024-03-13T23:13:28Z")

</div>

Is it expected that `handleDOMEvents.keypress` would not fire?

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)
#### Post date: [March 14, 2024, 7:48am UTC](https://discuss.prosemirror.net/t/handledomevents-keypress-doesnt-fire/6274/2 "2024-03-14T07:48:02Z")

</div>

Is your browser firing keypress events (those have been deprecated for a long time)? Did you handle/preventDefault the keydown event (that will prevent keypress from firing)?

---

<div class="post-metadata">

### Author: ![prosed](https://discuss.prosemirror.net/letter_avatar_proxy/v4/letter/p/aeb1de/32.png) [@prosed](https://discuss.prosemirror.net/u/prosed)
#### Post date: [March 16, 2024, 8:20pm UTC](https://discuss.prosemirror.net/t/handledomevents-keypress-doesnt-fire/6274/3 "2024-03-16T20:20:47Z")

</div>

Thanks for your reply @marijn!

I know they’re deprecated but some things are just really difficult to emulate with `keyup` and `keydown`.

I’m running Chrome 122 and indeed they do fire at the browser level.

It didn’t occur to me that `preventDefault` on `keydown` would prevent `keypress`.

I don’t know if it’s a valid test, but when I add an event listener with `document.addEventListener('keypress, ...)` and log out the event, `defaultPrevented` is `false`. I’m not sure if that runs before the editor’s `keydown` handlers?

But so ProseMirror _should_ fire the events? If so, I’ll report back if I ever find the cause of the problem.
