fullcalendar / fullcalendar-react

The official React Component for FullCalendar
https://fullcalendar.io/docs/react
MIT License
2.09k stars 110 forks source link

onContextMenu callback set in eventContent does not fire #158

Closed chunyinli closed 1 year ago

chunyinli commented 3 years ago

In 5.10.0, attaching a onContextMenu event on the content of eventContent no long fire if the eventClick option is passed in to FullCalendar. If eventClick option is not used then it works. It works either way in version 5.9.0. Appears to be specific to fullcalendar-react.

Reduced test case: https://codesandbox.io/s/fullcalendar-eventcontent-oncontextmenu-5-10-0-fyt9p

Interestingly, if the onContentMenu is attached to a button instead of a div, then it kinda works.

Example that shows it works in standard fullcalendar: https://codesandbox.io/s/fullcalendar-contentmenu-event-works-b5c00?file=/src/index.js

acerix commented 3 years ago

It looks like it could be a bug specific to this React component, but should work better to attach the callbacks in eventDidMount instead of eventContent.

chunyinli commented 3 years ago

Good idea, definitely going to look into attaching the event in eventDidMount, thanks.

arshaw commented 1 year ago

I'm nearly certain the root cause is this bug: https://github.com/fullcalendar/fullcalendar/issues/5963 ↑ Could you please visit the link, give a 👍 to vote (?), press the 🔈Subscribe button to receive updates?

The reason it's only happening in the React implementation (and not vanilla JS) is that React does event bubbling differently (see here).

Anyway, solving #5963 will likely fix this too