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

fix: date input click outside #9676

Merged
merged 7 commits into from
Jan 16, 2025
Merged

Conversation

magrinj
Copy link
Member

@magrinj magrinj commented Jan 16, 2025

See #9486

This PR fixes a latent bug that was caused by the recent dropdown focus id refactor. It was correctly implemented for dropdowns but not for places where we manually open and close dropdown-like components that also uses a useListenClickoutside.

This was the case for table cells and inline cells.

@magrinj magrinj changed the title fix: wip fix: date input click outside Jan 16, 2025
@lucasbordeau lucasbordeau marked this pull request as ready for review January 16, 2025 15:02
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Improved click-outside detection for the DateInput component by implementing pixel-based comparison and adding dropdown focus ID validation.

  • Added ClickOutsideMode.comparePixels in DateInput.tsx for more accurate click detection based on pixel coordinates
  • Implemented dropdown focus ID validation in useRegisterInputEvents.ts to prevent unwanted click-outside triggers
  • Added debug mode and improved logging in useListenClickOutside.ts for better troubleshooting
  • Refactored click detection logic using switch statements for cleaner mode handling
  • Added proper dependency tracking for listenerId in useListenClickOutside.ts

3 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Member Author

@magrinj magrinj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

@lucasbordeau lucasbordeau merged commit f621af1 into main Jan 16, 2025
46 checks passed
@lucasbordeau lucasbordeau deleted the fix/date-input-click-outside branch January 16, 2025 16:36
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.

2 participants