Skip to content

Comments

🐛 Fix: Runtime error when dragging all-day draft#289

Merged
tyler-dane merged 7 commits intomainfrom
fix/286-allday-drag
Mar 9, 2025
Merged

🐛 Fix: Runtime error when dragging all-day draft#289
tyler-dane merged 7 commits intomainfrom
fix/286-allday-drag

Conversation

@tyler-dane
Copy link
Contributor

@tyler-dane tyler-dane commented Mar 6, 2025

Closes #286

After

works.mov

This pull request includes several changes to the calendar event handling and testing in the packages/web directory. The most important changes involve refactoring the event mouse handling logic to differentiate between click and drag actions, updating related components, and adding new tests to ensure the functionality works as expected.

Event Mouse Handling Refactor:

  • Introduced useGridEventMouseDown hook to differentiate between click and drag actions based on mouse behavior.
  • This is a hook that differentiates between click and drag actions based on mouse behavior:
    • Quick press and release triggers a click
    • Hold for delay or move beyond threshold triggers drag
    • When form is open, only allows drag if mouse is still held down
  • This hook replaces the previous useGridEventMouseHold hook.

Test File Changes:

Additional Changes:

@tyler-dane tyler-dane linked an issue Mar 6, 2025 that may be closed by this pull request
@tyler-dane tyler-dane force-pushed the fix/286-allday-drag branch 2 times, most recently from 2561915 to d7793ef Compare March 7, 2025 15:45
if mousing up before threshold: click
if mouse is still down after threshold: drag
if mouse down + move before threshold: drag
- Update event form to stop event propagation on mouse events
- Add `type="button"` to delete buttons to prevent form submission
- Modify calendar test to use `document.body` for closing form
- Simplify event form mouse interaction logic
Remove commented-out test assertion to improve test coverage and clarity
@tyler-dane tyler-dane force-pushed the fix/286-allday-drag branch from 9642633 to b5b87c4 Compare March 8, 2025 22:30
@tyler-dane tyler-dane marked this pull request as ready for review March 8, 2025 22:30
@tyler-dane tyler-dane force-pushed the fix/286-allday-drag branch from c2702c1 to 6229f57 Compare March 9, 2025 00:13
@tyler-dane tyler-dane merged commit c18b08c into main Mar 9, 2025
3 checks passed
@tyler-dane tyler-dane deleted the fix/286-allday-drag branch March 9, 2025 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime error when dragging an all-day draft

1 participant