Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only listen to resize events from the iframe #89

Merged
merged 1 commit into from
May 29, 2021
Merged

Conversation

laymonage
Copy link
Member

@laymonage laymonage commented May 29, 2021

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
Copy link

vercel bot commented May 29, 2021

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