fix: close Dropdown on click outside in Safari#1365
fix: close Dropdown on click outside in Safari#1365shinokada merged 1 commit intothemesberg:mainfrom
Conversation
|
@cpsoinos is attempting to deploy a commit to the Themesberg Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe recent changes to the Changes
Assessment against linked issues
Poem
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/lib/utils/Popper.svelte (2 hunks)
Additional comments not posted (2)
src/lib/utils/Popper.svelte (2)
Line range hint
154-167: Addition of event listener for 'click' to handle clicks outside the popper.Ensure the removal of the event listener in the
onDestroyfunction is thoroughly tested to avoid memory leaks.
171-181: Implementation of thecloseOnClickOutsidefunction to address the Safari-specific bug.This function effectively checks if the click event is outside the popper and its trigger elements before calling
hideHandler. This is a critical fix for the issue described.
8839e45 to
bccf8ab
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/lib/utils/Popper.svelte (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/lib/utils/Popper.svelte
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Thank you for your contribution. |
Closes #1237
📑 Description
Currently,
Dropdownhas a bug where clicking outside an open dropdown in Safari will not close it. It works in Chrome and Firefox as-is, but not Safari.This PR adds explicit event handling to clicks on the document outside the
Popperor its triggering elements. It checks if the click is on the floating element or its trigger(s), and if not, closes the popper using the existinghideHandler.Status
✅ Checks
ℹ Additional Information
There is an existing
clickOutsideutility, but it is not a fit for this use case. We need to check both the floating element and its triggers here, which is not possible in the existingclickOutsidefunction.Summary by CodeRabbit