Keyboard delete event bug

It would seem that there is a bug with keyboard handling when dealing with recurring events (in React). If i use the delete key after selecting the event, the onEventDelete doesn’t get fired, but rather the onEventUpdate event. And the event gets removed from the UI because it’s removed before it even fires the event handler. Is this a known bug? Workaround possible?

const onEventUpdate = useCallback(async (args) => {
  if (args.domEvent.keyCode === 46) {
    return false; // abort update
  }
}, []);

const onEventDelete = useCallback(async (args) => {
  console.log('onEventDelete'); // never fired
}, []);

<Eventcalendar data={myEvents} onEventUpdate={onEventUpdate} onEventDelete={onEventDelete} />

To clarify the issue better, here’s a video of me selecting a single event, closing the popup, then deleting the event via the keyboard.

You can see (kinda in the console) that no onEventDelete is fired, but instead onEventUpdate is fired and it’s actually removed from the UI before receiving the event. It’s a recurring event so I need to prevent it from happening and return an error message, however I can’t because it was already removed from the UI internally so returning false from the onEventUpdate handler has no effect.

calendar_delete_bug

Hi @MichaelBrown,

The recurring events are working a little bit different then regular events. Here you can find a live demo which demonstrates how you can handle specific recurring event modifications.

When an occurrence of a recurring event was deleted, the onEventUpdate will be triggered and the occurrence date will be added as a recurring exception to the original recurring event.

To distinguish it from a regular event update there will be isDelete: true propery in the arguments object, and the newEvent property won’t be populated. Otherwise when a recurring event was updated this property will hold newly created event object.