🐛 Cache la barre de défilement des iframes

Fixes #1462
pull/1538/head
Maxime Quandalle 2021-05-07 14:52:06 +02:00
parent b898f573ee
commit 4632ddb215
1 changed files with 9 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import { IsEmbeddedContext } from 'Components/utils/embeddedContext'
import { useEffect } from 'react'
import { Helmet } from 'react-helmet'
import { Route, Switch } from 'react-router-dom'
import useSimulatorsData from '../Simulateurs/metadata'
@ -8,6 +9,14 @@ import IframeFooter from './IframeFooter'
export default function Iframes() {
const simulators = useSimulatorsData()
// We hide the vertical scrollbar in the iframe because the iframe is resized
// using the "iframe-resizer" module, and if we keep the scrollbar it appears
// briefly during transitions, cf.
// https://github.com/betagouv/mon-entreprise/issues/1462
useEffect(() => {
document.body.style.overflowY = 'hidden'
}, [])
return (
<IsEmbeddedContext.Provider value={true}>
{/** Open external links in the parent frame.