Skip to content

Commit 69a1797

Browse files
Add dark=false param for in-house interactives
1 parent 2698ed3 commit 69a1797

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

dotcom-rendering/src/components/InteractiveBlockComponent.importable.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -346,23 +346,23 @@ export const InteractiveBlockComponent = ({
346346
}
347347

348348
// Datawrapper-specific fix to suppress scrollbars appearing
349-
if (url.includes('datawrapper')) {
350-
iframe.scrolling = 'no';
351-
// Turn off dark mode for Datawrapper embeds on web
352-
// This should be removed if/when dark mode is implements on the website
353-
if (
354-
!document.querySelector('.ios') &&
355-
!document.querySelector('.android')
356-
) {
357-
const prefersDarkScheme = window.matchMedia(
358-
'(prefers-color-scheme: dark)',
359-
).matches;
360-
const darkMode = darkModeAvailable && prefersDarkScheme;
361-
if (!darkMode) {
362-
iframe.src +=
363-
(iframe.src.includes('?') ? '&' : '?') +
364-
'dark=false';
365-
}
349+
if (url.includes('datawrapper')) iframe.scrolling = 'no';
350+
351+
// Bespoke dark mode logic for Datawrapper and ai2html embeds on web
352+
// This should be removed if/when dark mode is implements on the website
353+
if (
354+
!document.querySelector('.ios') &&
355+
!document.querySelector('.android') &&
356+
(url.includes('datawrapper') ||
357+
url.includes('interactive.guim.co.uk/uploader/embed/'))
358+
) {
359+
const prefersDarkScheme = window.matchMedia(
360+
'(prefers-color-scheme: dark)',
361+
).matches;
362+
const darkMode = darkModeAvailable && prefersDarkScheme;
363+
if (!darkMode) {
364+
iframe.src +=
365+
(iframe.src.includes('?') ? '&' : '?') + 'dark=false';
366366
}
367367
}
368368

0 commit comments

Comments
 (0)