[wp-trac] [WordPress Trac] #63759: Replace event.keyCode with event.key

WordPress Trac noreply at wordpress.org
Mon Jul 28 00:05:29 UTC 2025


#63759: Replace event.keyCode with event.key
-------------------------+-----------------------------
 Reporter:  joedolson    |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  minor        |   Keywords:
  Focuses:  javascript   |
-------------------------+-----------------------------
 Much of the scripting across non-React JS WordPress codebase uses
 `event.keyCode` to manage keyboard events. `keyCode` has been deprecated
 for many years, and we really only need to maintain backwards
 compatibility with this as long as we supported Internet Explorer, since
 IE11 continued to have buggy support for `event.key`.

 `event.code` still has unreliable support, which makes this harder to
 implement, but `event.key` is widely supported.

 In many cases, using `event.key` is more predictable, as is is less
 dependent on physical keyboard layout.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63759>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list