fix: dashboard edit mode widget selection blocked by SchemaRenderer content#815
fix: dashboard edit mode widget selection blocked by SchemaRenderer content#815
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…click-to-select In dashboard edit mode, SchemaRenderer content (charts, tables, interactive SVGs) was intercepting click events before they could bubble to the widget Card/div selection handler. This prevented users from selecting widgets in the left/main dashboard area. Fix: Apply pointer-events-none to SchemaRenderer content wrappers when designMode is active, allowing clicks to pass through to the parent element's onClick handler. This enables proper widget selection while maintaining full interactivity in non-edit mode. Added 4 new tests verifying the fix. Updated ROADMAP.md with Phase 9 entry. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 仔细评估是否已经彻底解决相关问题 |
…rd design mode The initial pointer-events-none fix alone is not fully robust — SVG chart elements (e.g. Recharts tooltip hitbox rect) can override inherited pointer-events via explicit SVG attributes, allowing clicks to be captured by chart content instead of the widget selection handler. Added defense-in-depth: 1. pointer-events-none on content (disables chart hover/tooltip in design mode) 2. Transparent absolute overlay (z-10) on top of widget content captures all clicks unconditionally, regardless of SVG pointer-events overrides Also improved test mock to forward className and include interactive child element for more realistic testing. Added 5 new tests for overlay behavior. 115 total dashboard tests pass. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
经过仔细评估,发现初始的 在 commit
涵盖范围:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug where dashboard widgets were unselectable in edit mode because interactive child elements (charts, tables, SVG elements) intercepted click events before they could reach the widget selection handlers. The solution implements a defense-in-depth approach with two complementary layers: pointer-events-none on content wrappers to disable interactivity, and a transparent click-capture overlay to guarantee clicks reach the handler even when SVG elements override CSS properties.
Changes:
- Added dual-layer click protection (pointer-events-none + transparent overlay) to both self-contained and Card-based widgets in design mode
- Enhanced test mock to forward className and include interactive child elements for more realistic testing
- Added 9 comprehensive tests covering pointer-events-none behavior, overlay presence/absence, positioning, and click-to-select functionality
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/plugin-dashboard/src/DashboardRenderer.tsx | Implemented defense-in-depth click handling: added pointer-events-none to SchemaRenderer content wrappers, transparent absolute inset-0 z-10 overlay, and relative positioning to widget containers, all gated on designMode |
| packages/plugin-dashboard/src/tests/DashboardRenderer.designMode.test.tsx | Enhanced SchemaRenderer mock to forward className and include interactive button child; added 9 new tests for pointer-events-none, overlay rendering, and click behavior verification |
| ROADMAP.md | Added Phase 9 documentation describing the fix, defense layers, and test coverage |
Widgets in the dashboard main area are unselectable in edit mode. Clicks on charts/tables rendered by
SchemaRendererare consumed by interactive child elements (SVG, canvas, table rows) before bubbling to theCard/divselection handler.Fix — Defense in Depth
Two complementary layers ensure clicks always reach the widget selection handler in design mode:
pointer-events-noneon content wrappers: Disables chart/table interactivity (tooltips, hover effects) in design mode. Handles most standard HTML elements.Transparent click-capture overlay (
absolute inset-0 z-10): Rendered on top of all widget content in design mode. Guarantees clicks reach the widget'sonClickhandler even if SVG child elements (e.g. Recharts tooltip hitbox<rect>) override inheritedpointer-eventsvia explicit SVG attributes.DashboardRenderer.tsx—pointer-events-noneon content wrappers + transparent click-capture overlay withrelativepositioning on widget containers, all gated ondesignModeDashboardRenderer.designMode.test.tsx— Updated mock to forwardclassNameand include interactive child element; 9 new tests for pointer-events-none, overlay presence/absence, z-index, relative positioning, and click-to-selectROADMAP.md— Phase 9 entry updatedNon-edit mode is unaffected — widgets remain fully interactive with no overlays or pointer-events changes. All 115 dashboard tests pass (11 files).
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.