Skip to content
masterclass Buddy

React Testing Library · Method

fireEvent.keyDown

fireEvent.keyDown dispatches a keydown event on a DOM element. Pass keyboard details such as key and code; focus the element first when the test should reflect normal keyboard behavior.

Last updated

Syntax

fireEvent.keyDown(node, eventProperties)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • fireEvent
  • fireEvent.keyPress
  • fireEvent.keyUp
  • createEvent[eventName]
  • user-event

Source: Firing Events | Testing Library. Checked 2026-11-03.