-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add event doubleClick handler #567
Conversation
src/Calendar.js
Outdated
@@ -112,6 +112,24 @@ class Calendar extends React.Component { | |||
onSelectSlot: PropTypes.func, | |||
|
|||
/** | |||
* Callback fired when empty calendar cell was clicked twice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"when an empty calendar [...]"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/Calendar.js
Outdated
* (date: Date, e: SyntheticEvent) => any | ||
* ``` | ||
*/ | ||
onDoubleClickAllDaySlot: PropTypes.func, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have a normal click
equivalent to this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to separate onDoubleClickSlot
and onDoubleClickAllDaySlot
. Because both of them can get same date
parameter, but handling behavior is usually different for clicks on regular cells and all-day cells.
What do you think?
src/less/month.less
Outdated
@@ -28,6 +28,7 @@ | |||
height: auto; | |||
line-height: normal; | |||
white-space: nowrap; | |||
pointer-events: all; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This point is important.
As .rbc-row-content
is overlaying .rbc-day-bg
(in month view), that is listening to doubleClick
events, we have to add pointer-events: none
to .rbc-row-content
, and pointer-events: all
to all active elements inside it (events, popup link, day number link) read more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that may be a problem, first it won't work in older browsers and second I think it is going to break the drag and drop code as well, since they also mess with pointer-events.
Maybe we can narrow the scope of this PR a bit, and only add doubleClick handlers where there is already a click handler, that will make sure we have a nice parity and we can talk about adding new handlers in a separate PR/issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I checked. It doesn't make problems with DnD. Moreover, pointer-events
properties are already used in some places of DnD addon. I can't see any other solutions, how to catch doubleClick
events under .rbc-row-content
overlay (remember, that clicked date should be calculated and passed to handler. this is a limitation)
Ok, I'll leave onDoubleClickEvent
in this PR, and onDoubleClickSlot
and onDoubleClickAllDaySlot
will be moved to another one, where we can discuss the problem above
PR description was changed |
src/Calendar.js
Outdated
* Callback fired when a calendar event is clicked twice. | ||
* | ||
* ```js | ||
* (event: Object, e: SyntheticEvent) => any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be => void
for the return type i believe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jquense done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just that one nit
This PR is part of #563 issue
New:
onDoubleClickEvent
handlerCallback fired when a calendar event is clicked twice.
(event: Object, e: SyntheticEvent) => any
All changes are similar to
onSelectEvent
handler