sadpandajoe opened a new pull request, #45570:
URL: https://github.com/apache/superset/pull/45570

   ### SUMMARY
   Hovering the right-most part of a Partition (icicle) chart left the tooltip 
positioned past the chart's right edge, so on dashboards (where the chart 
container clips overflow) it appeared to vanish. The Treemap chart does not 
have this problem because its echarts tooltip flips to the other side of the 
cursor.
   
   This change makes the Partition tooltip do the same: after the tooltip 
content is rendered it is measured, and if `cursorX + 15px + tooltipWidth` 
would exceed the chart width it is placed to the left of the cursor instead 
(clamped at 0). Otherwise the placement is unchanged.
   
   The bottom edge and other legacy D3 plugins are intentionally left untouched.
   
   ## Root Cause
   `positionAndPopulate()` in `plugin-chart-partition/src/Partition.ts` set the 
tooltip's `left` to `cursorX + 15px` unconditionally, with no comparison 
against the chart width or the tooltip's width. This line dates back to the 
original `Partition.js` and was carried through the later plugin migrations 
unchanged. Near the right edge the tooltip's right edge lands beyond the chart; 
the dashboard chart wrapper uses `overflow: hidden`, so the overflowing part is 
cut off. The Partition plugin also had no tests, and could not be imported 
under Jest because `d3-hierarchy@3` is ESM-only and was missing from the 
`transformIgnorePatterns` allow-list.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   UI before/after evidence will follow in this section once captured against 
this change.
   
   Regression guard (jsdom, driving the real `mousemove` handler with stubbed 
layout):
   - Before the fix: `places the tooltip right of the cursor when there is 
room` passes; `keeps the tooltip inside the chart when hovering near the right 
edge` fails (`Expected: <= 400, Received: 525`).
   - After the fix: both pass; the whole `plugin-chart-partition` test 
directory passes (6 suites, 23 tests).
   
   ### TESTING INSTRUCTIONS
   1. Create or open a Partition chart (for example from a dataset with a 
couple of group-by levels) and add it to a dashboard.
   2. Hover over the right-most blocks of the chart.
   3. The tooltip should appear to the left of the cursor and stay fully 
visible; hovering elsewhere should still show it to the right of the cursor.
   4. Run the unit test: `cd superset-frontend && npx jest 
plugins/plugin-chart-partition`.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to