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

   ### SUMMARY
   Exporting a chart or dashboard as an image produces a blank or partial file 
in Safari/WebKit. The export path uses `dom-to-image-more`, which rasterizes a 
node by wrapping it in an SVG `<foreignObject>`; Safari applies a stricter 
security model to `<foreignObject>` and refuses to paint it. The library 
documents Safari as unsupported for exactly this reason: 
https://github.com/IDisposable/dom-to-image-more#browsers
   
   This routes the capture through `html2canvas` when `isSafari()` is true. 
`html2canvas` paints the live DOM directly, so it works across engines. 
Non-Safari browsers are unaffected and keep the existing `dom-to-image-more` 
pipeline (including the ag-grid print-layout and ECharts high-resolution 
handling). The `html2canvas` dependency was already pulled in transitively via 
`dom-to-pdf`; this promotes it to a direct dependency.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A — reproducing the fix requires a Safari/WebKit browser.
   
   ### TESTING INSTRUCTIONS
   1. Open a dashboard or chart in Safari (or any WebKit-based browser).
   2. Use "Download" → "Export as image" (JPEG or PNG, solid or transparent 
background).
   3. The downloaded image should contain the rendered chart instead of being 
blank or partial.
   4. In Chrome/Firefox, confirm the export is unchanged.
   
   Unit tests: `npx jest src/utils/downloadAsImage.test.ts` covers the engine 
selection, transparent/scaled PNG options, the node filter, and the error path.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: #28713
   - [ ] 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