Home / Function/ KeyboardEventInterface.keyCode() — react Function Reference

KeyboardEventInterface.keyCode() — react Function Reference

Architecture documentation for the KeyboardEventInterface.keyCode() function in SyntheticEvent.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  66e5c979_0dfd_3096_3297_900ad4a67472["KeyboardEventInterface.keyCode()"]
  9c3d71d9_41af_c5e7_cd35_d25bbf6cf606["SyntheticEvent.js"]
  66e5c979_0dfd_3096_3297_900ad4a67472 -->|defined in| 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606
  style 66e5c979_0dfd_3096_3297_900ad4a67472 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/events/SyntheticEvent.js lines 472–484

  keyCode: function (event: {[propName: string]: mixed}) {
    // `keyCode` is the result of a KeyDown/Up event and represents the value of
    // physical keyboard key.

    // The actual meaning of the value depends on the users' keyboard layout
    // which cannot be detected. Assuming that it is a US keyboard layout
    // provides a surprisingly accurate mapping for US and European users.
    // Due to this, it is left to the user to implement at this time.
    if (event.type === 'keydown' || event.type === 'keyup') {
      return event.keyCode;
    }
    return 0;
  },

Domain

Subdomains

Frequently Asked Questions

What does KeyboardEventInterface.keyCode() do?
KeyboardEventInterface.keyCode() is a function in the react codebase, defined in packages/react-dom-bindings/src/events/SyntheticEvent.js.
Where is KeyboardEventInterface.keyCode() defined?
KeyboardEventInterface.keyCode() is defined in packages/react-dom-bindings/src/events/SyntheticEvent.js at line 472.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free