1 export const isKeyboardEvent = (event: Event): event is KeyboardEvent => {
8 export const isDragEvent = (event: Event): event is DragEvent => {
9 if ('dataTransfer' in event) {
15 const assignKeyboardKeys = (customEvent: CustomEvent, event: Event) => {
16 const KEYBOARD_EVENT_RELATED_KEYS = [
30 KEYBOARD_EVENT_RELATED_KEYS.forEach((key) => {
32 customEvent[key] = event[key];
36 export const cloneEvent = (event: Event) => {
37 const clonedEvent = new CustomEvent(event.type, { bubbles: true });
39 if (isDragEvent(event)) {
40 // @ts-expect-error 'dataTransfert' key is not present in customEvent interface
41 clonedEvent.dataTransfer = event.dataTransfer;
44 if (isKeyboardEvent(event)) {
45 assignKeyboardKeys(clonedEvent, event);