diff --git a/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.scss b/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.scss index b1159762b32..b2f19a066a2 100644 --- a/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.scss +++ b/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.scss @@ -59,6 +59,10 @@ $controlRowHeight: 32px; // keep in sync with CONTROLS_ROW_HEIGHT &.GrapherComponent.optimizeForHorizontalSpace .relatedQuestion { border-top: 0; + // adds a top border that stretches across the entire page. + // since we don't know the width of the page, we use a large number (200vw) + // and offset it by another large number (-50vw) to make sure the border + // stretches across the entire page. &::before { content: ""; position: absolute; diff --git a/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.tsx b/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.tsx index 1b3aca2f4ad..40d2a7c4c52 100644 --- a/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.tsx +++ b/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.tsx @@ -593,9 +593,13 @@ export class StaticCaptionedChart extends CaptionedChart { } } +// Although a bit unconventional, adding vertical space as a
+// makes margin collapsing impossible and makes it easier to track the +// space available for the chart area (see the CaptionedChart's `chartHeight` method) function VerticalSpace({ height }: { height: number }): JSX.Element { return (