antoniandre / vue-cal

A Vue.js full calendar, no dependency, no BS. :metal:
https://antoniandre.github.io/vue-cal/
MIT License
1.23k stars 234 forks source link

on-event-click not firing (but on-event-dblclick works perfectly) #489

Closed LouisRoyT closed 2 years ago

LouisRoyT commented 2 years ago

I can successfully use the @event-focus , and I can also successfully bind :on-event-dblclick. However, trying to bind to :on-event-click is not working at all.

Thanks to the documentation and @samueljtaylor for your tips on issue 391 in finding workarounds :on-event-dblclick and @event-focus . I'd be happy to know what's the cause of this problem, whether it's on my end or an actual bug.

Here are some screenshots of my project that illustrate the bug. image image image image

antoniandre commented 2 years ago

Hi @LouisRoyT, Thanks for the details. But could you provide a reproduction example so I can investigate? thanks.

LouisRoyT commented 2 years ago

That's where it gets tricky. I made a codePen to post here, but... the issue doesn't occur on the codePen... I scoured my code and the codePen to see what might be different, but to no avail.

Here it is for completeness sake, but as I mentioned, it does not reproduce the bug. https://codepen.io/louisroyt/pen/BarYryL

I know it's not much to go on and I'll understand if you drop the issue since we can't reproduce. Figured I'd document it. Sometimes outside eyes see things right away.

itssamtaylor commented 2 years ago

Since I was tagged, I thought I'd see if I could reproduce the bug but haven't been able to do so either. I tried your codePen and also spun up a simple app to test it out with the data coming from props and from an api call, unfortunately it all behaves as expected.

Depending on what you're planning on doing with the double click and single click events, I noticed if a single click event has an alert or something to interrupt the user, the double click event will not be fired.

In your screenshots is there a reason for your both single and double click being bound to onEventDblClick?

Also are you using the newest version of vue-cal and Vue 3?

LouisRoyT commented 2 years ago

My project uses Vue 2.7.4, therefore I used vue-cal@legacy (vue-cal 3.10.4)

I realise I am reusing the onEventDblClick for both events. No particular reason for this. I just reused the same method for tests.

Thanks for taking a look. I've decided to go with on-dblclick for now. It provides a good UX too. I'll keep you posted if I find the cause of the problem, but for now I've stopped actively looking for it.

LouisRoyT commented 2 years ago

If I used only @event-focus, it would work on first click, but I guess the event stayed focused, because closing the modal and then clicking it again did nothing.

I found that using both :on-event-click="someMethodThatExists" and @event-focus="someMethod" solved this problem. (Whatever method I pass to :on-event-click still does not get called btw. But it does need to exist, otherwise I get the same result as not binding to :on-event-click at all(no focus reset))

on-event-click-event-Focus2