MCPcopy Index your code
hub / github.com/react/react / createKeyboardEvent

Function createKeyboardEvent

packages/dom-event-testing-library/domEvents.js:139–165  ·  view source on GitHub ↗
(
  type,
  {
    altKey = false,
    ctrlKey = false,
    isComposing = false,
    key = '',
    metaKey = false,
    preventDefault = emptyFunction,
    shiftKey = false,
  } = {},
)

Source from the content-addressed store, hash-verified

137}
138
139function createKeyboardEvent(
140 type,
141 {
142 altKey = false,
143 ctrlKey = false,
144 isComposing = false,
145 key = '',
146 metaKey = false,
147 preventDefault = emptyFunction,
148 shiftKey = false,
149 } = {},
150) {
151 const modifierState = {altKey, ctrlKey, metaKey, shiftKey};
152
153 return createEvent(type, {
154 altKey,
155 ctrlKey,
156 getModifierState(keyArg) {
157 return createGetModifierState(keyArg, modifierState);
158 },
159 isComposing,
160 key,
161 metaKey,
162 preventDefault,
163 shiftKey,
164 });
165}
166
167function createMouseEvent(
168 type,

Callers 2

keydownFunction · 0.85
keyupFunction · 0.85

Calls 1

createEventFunction · 0.70

Tested by

no test coverage detected