Skip to content

Only listen to resize events from the iframe#89

Merged
laymonage merged 1 commit into
mainfrom
fix-resizer
May 29, 2021
Merged

Only listen to resize events from the iframe#89
laymonage merged 1 commit into
mainfrom
fix-resizer

Conversation

@laymonage

@laymonage laymonage commented May 29, 2021

Copy link
Copy Markdown
Member

By default, iFrameResizer listens to resize events from the parent page. Unfortunately, using giscus' client script in an SPA will leave the event listener intact, even if the <iframe> element is no longer there (e.g. the user moves to a different page). We cannot use iFrameResizer's react, vue, or other client libraries because we cannot know the specifics of the host website.

This PR changes the iFrameResizer config to only listen to resize events from the child element, meaning that it will only resize if the giscus widget is resized. When the <iframe> no longer exists in the page, (I think) the event won't be fired again.

See davidjbradshaw/iframe-resizer#566.

@vercel

vercel Bot commented May 29, 2021

Copy link
Copy Markdown

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/laymonage/giscus/AUV4aDUdsqULcSSnQKfTYmFiuQju
✅ Preview: https://giscus-git-fix-resizer-laymonage.vercel.app

@laymonage
laymonage merged commit 14778c2 into main May 29, 2021
@laymonage
laymonage deleted the fix-resizer branch May 29, 2021 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant