-
Notifications
You must be signed in to change notification settings - Fork 274
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: Fixes clickoutside handler function for issue #1475 #1476
fix: Fixes clickoutside handler function for issue #1475 #1476
Conversation
@bmanth60 is attempting to deploy a commit to the Themesberg Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe changes made in this pull request involve the Changes
Assessment against linked issues
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
I am unable to run tests:
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
src/lib/datepicker/Datepicker.svelte (1)
Line range hint 37-45
: Consider a more robust click detection strategy.
The current document-level click listener might limit the component's reusability in iframe contexts. For future improvement, consider:
- Using a portal/teleport pattern to handle modal-like behavior
- Attaching the click listener to a closer ancestor element
- Using the
composed: true
option in event handling to detect clicks across shadow DOM boundaries
This would make the component more versatile for various integration scenarios.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- src/lib/datepicker/Datepicker.svelte (3 hunks)
🔇 Additional comments (2)
src/lib/datepicker/Datepicker.svelte (2)
28-28
: LGTM: Well-typed container reference.
The new variable is appropriately typed and follows naming conventions.
253-253
: LGTM: Correct container binding placement.
The bind:this directive is correctly placed on the root container div, ensuring proper click detection for the entire datepicker component.
Note: As mentioned in the PR description, clicks within iframes won't be detected since the click listener is bound to the top-level document. To verify iframe usage:
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Chizaruu Are you happy with this? |
Looks good! |
Closes #1475
📑 Description
Fixes the click outside dom check to find nodes within the datepicker container rather than looking at the input field
Status
✅ Checks
ℹ Additional Information
Recording.2024-10-29.120805.mp4
There is still an issue with the example, the listener is binding to the top level document, and clicks within the iframe is not registered so the example looks broken even though it is functioning
Summary by CodeRabbit