[WEB-6137] fix: work item peek view outside click#8610
[WEB-6137] fix: work item peek view outside click#8610anmolsinghbhatia wants to merge 1 commit intopreviewfrom
Conversation
📝 WalkthroughWalkthroughThe changes implement an exclusion mechanism for the peek-overview outside-click detector. The sidebar is marked with an id and conditional prevent-outside-click attribute, the detector hook is updated to accept an exclusion list of element ids, and the peek-overview view passes the sidebar id as an excluded element to allow clicks on specific areas to still close the overlay. Changes
Sequence DiagramsequenceDiagram
actor User
participant Sidebar as Resizable Sidebar<br/>(id: main-sidebar)
participant Detector as Outside-Click Detector
participant PeekView as Peek-Overview View
User->>Sidebar: Clicks on sidebar
Sidebar->>Detector: Detects click event
Detector->>Detector: Check for data-prevent-outside-click
alt Element has attribute
Detector->>Detector: Get element id<br/>(main-sidebar)
Detector->>Detector: Check if id in<br/>excludePreventionElementIds
alt ID in exclusion list
Detector->>PeekView: Proceed with callback<br/>(close overlay)
else ID not excluded
Detector->>Detector: Prevent callback
end
else No attribute found
Detector->>PeekView: Proceed with callback
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes the peek view outside click behavior when navigating from the sidebar. The issue was that clicking on sidebar elements (which have the data-prevent-outside-click attribute) would not close the peek view, even though the desired behavior is to close it when clicking on the sidebar.
Changes:
- Added an exclusion mechanism to the outside click detection hook that allows specific elements with
data-prevent-outside-clickto bypass the prevention behavior - Added an
id="main-sidebar"to the sidebar element for identification - Configured the peek overview to exclude the main-sidebar from outside click prevention
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/web/core/hooks/use-peek-overview-outside-click.tsx | Added excludePreventionElementIds parameter to allow selective bypassing of the data-prevent-outside-click behavior for specific elements |
| apps/web/core/components/sidebar/resizable-sidebar.tsx | Added id="main-sidebar" to identify the sidebar element for the exclusion mechanism |
| apps/web/core/components/issues/peek-overview/view.tsx | Passed ["main-sidebar"] as the exclusion list to enable outside click on the sidebar |
| }, | ||
| issueId | ||
| issueId, | ||
| ["main-sidebar"] |
There was a problem hiding this comment.
Passing an array literal directly to the hook can cause unnecessary re-renders. Each time this component renders, a new array instance is created, which will cause the useCallback dependency to change and the handleClick callback to be recreated.
Consider defining this array outside the component or using useMemo to memoize it, especially if this component re-renders frequently. For example: const EXCLUDED_IDS = useMemo(() => ["main-sidebar"], []); or define it as a constant outside the component if it never changes.
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
Description
This PR fixes the behaviour of the peek view outside click when navigating from the sidebar.
Type of Change
Summary by CodeRabbit