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

   ### SUMMARY
   
   Treemap tooltips lose the `<NULL>` dimension label because it is inserted 
into the tooltip HTML as a tag and removed by the HTML sanitizer. Escape the 
hierarchy title before passing it to `tooltipHtml` so dimension names are 
rendered as text. This also preserves names containing angle brackets, 
ampersands, and literal HTML entities.
   
   Refs #43547 (item 3, Treemap tooltip only).
   
   AI assistance: I used Codex to help investigate, implement, and validate 
this change, and to translate my explanation into English.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   The screenshots use the branch frontend with an isolated local demo backend 
and the same saved chart. The older backend omits the chart-header 
`metadata.editors` field, so the browser capture harness supplies an empty list 
for that field only. Chart-data responses and tooltip output are unmodified. 
The before capture uses the master Treemap implementation; the after capture 
uses this fix.
   
   Before:
   
   ![The screenshots use the branch frontend with an isolated local demo 
backend and the same saved chart. The older backend omits the chart-header 
`metadata.editors` field, so the browser capture harness supplies an empty list 
for that field only. Chart-data responses and tooltip output are unmodified. 
The before capture uses the master Treemap implementation; the after capture 
uses this fix.
   
   Before: the NULL tooltip title is 
missing](https://raw.githubusercontent.com/shchun/superset/83d1e9ff675860577ad89d7404db4ecd0c17d7e4/treemap-before.png)
   
   After:
   
   ![After: the tooltip title displays 
NULL](https://raw.githubusercontent.com/shchun/superset/83d1e9ff675860577ad89d7404db4ecd0c17d7e4/treemap-after.png)
   
   ### TESTING INSTRUCTIONS
   
   1. In SQL Lab, run the query below and save it as a virtual dataset:
   
   ```sql
   SELECT 'alpha' AS category, 65 AS value
   UNION ALL SELECT 'beta', 80
   UNION ALL SELECT NULL, 72
   ```
   
   2. Create a Treemap using `category` as the dimension and `SUM(value)` as 
the metric.
   3. Hover over the NULL node. The tooltip title should show `<NULL>`.
   4. Confirm tooltips for the other categories still display their names and 
metric values.
   
   Automated validation from `superset-frontend`:
   
   ```bash
   npm run test -- --runInBand 
plugins/plugin-chart-echarts/test/Treemap/formatTooltip.test.ts 
plugins/plugin-chart-echarts/test/Treemap/transformProps.test.ts 
plugins/plugin-chart-echarts/test/Treemap/buildQuery.test.ts 
plugins/plugin-chart-echarts/test/Treemap/EchartsTreemap.test.tsx
   ```
   
   - Four suites passed, 14 tests total. The eight added regression cases cover 
single and nested NULL paths, empty and literal `null` categories, special 
characters, and literal HTML entities.
   - Applicable pre-commit hooks passed on the three changed files, including 
frontend type checking, in a Linux Node 24 validation copy verified to match 
the working branch. Referenced package declarations were built first.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Refs #43547
   - [ ] 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]

  • [PR] fix(tr... shchun (via GitHub) via notifications
    • Re: [P... netlify[bot] (via GitHub) via notifications
    • Re: [P... codeant-ai-for-open-source[bot] (via GitHub) via notifications
    • Re: [P... codecov[bot] (via GitHub) via notifications

Reply via email to