owid-grapher
owid-grapher copied to clipboard
Static SVGs shouldn't contain <foreignObject>s
Description
Static SVGs seem to contain <foreignObject>
, even though nothing is rendered inside of one (I think?)
Expected behaviour
Any <foreignObject>
should be excluded from static SVGs.
Examples
- https://ourworldindata.org/grapher/exports/share-of-land-covered-by-lakes-and-rivers.svg
Probably the fix is to check isExportingtoSvgOrPng
is false
before a <foreignObject>
is embeded.
Prioritising as important since these are the potential cause for some broken SVGs in the SVG tester, and should be very easy to fix.
The <foreignObject>
contents appear truncated for some reason (see here):
Ah, once that is fixed we can probably also remove some special code handling react-select
ids from the svgTester:
https://github.com/owid/owid-grapher/blob/073a087f936f0fc14f80540d2b663d517f030906/devTools/svgTester/utils.ts#L275
Downgrading to nice to have
, happy for someone to pick it up during cooldown.
This problem is basically done now - the NoDataModal is the only thing that still comes up when you search our current svg tester repo for foreginObject. We could fix that too at some point but that is more for convenience