Skip to content
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

Horizontal resize of an all day event is failing when Time view is scrolled in Week mode #2432

Open
5 tasks done
dimitribarbot opened this issue Aug 11, 2023 · 0 comments
Open
5 tasks done
Labels

Comments

@dimitribarbot
Copy link

Check that this is really a bug

  • I confirm

Reproduction link

https://jquense.github.io/react-big-calendar/examples/index.html?path=/docs/addons-drag-and-drop--example-1

Bug description

In the Basic Drag n Drop example, switch to Week mode and scroll the Time view a little bit down. Then, try to resize either on the right or left an all day event ("Conference" in the following example):

image

An error occurs in the EventContainerWrapper file with the following message:

image

To my understanding, it is failing because the handleResize event is called with a RIGHT or LEFT direction whereas the code does not handle it. The update method is called with an undefined newRange variable which makes the component crash.

However, by digging a little bit in the code, I found that this behavior seems to not be expected as I understand that the EventContainerWrapper should not handle events in the Week header, only the WeekWrapper should do that. It seems that the code in the beforeSelect event of the selector of the EventContainerWrapper should return false but in the case of a scrolled Time view, it is returning true. It is due to the green section of the EventContainerWrapper node visible in my screenshot above which crosses the Week header and indicates to the EventContainerWrapper to handle the event. When the Time view is not scrolled (parent.scrollTop is 0), the green rectangle is below the Week header, it does not cross it, consequently the crash does not occur in that case.

Maybe should we take the parent.scrollTop into account when computing the pointInColumn in the case of a resize in the beforeSelect event of the selector of the EventContainerWrapper ? Also, a quick fix would be to only call update in the case of an UP or DOWN direction or if newRange is defined.

Expected Behavior

No crash when resizing an all day event in the Week mode if the Time view is scrolled down.

Actual Behavior

A crash in the EventContainerWrapper occurs when resizing an all day event in the Week mode if the Time view is scrolled down.

react-big-calendar version

1.8.2

React version

18.2.0

Platform/Target and Browser Versions

Windows / Brave

Validations

  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a react-big-calendar issue and not an implementation issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant