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

Embed js height fix #22141

Merged
merged 6 commits into from Dec 15, 2022
Merged

Embed js height fix #22141

merged 6 commits into from Dec 15, 2022

Conversation

hodgesmr
Copy link
Contributor

@hodgesmr hodgesmr commented Dec 7, 2022

Fixes #22109 - executes the script to resize the iframes after document.readyState === "complete"

Before After
Screen Shot 2022-12-06 at 5 55 59 PM Screen Shot 2022-12-07 at 5 54 06 PM

Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, the issue was that loaded() was called too early? I suppose document.readyState can't be 'complete' at the time this script is executed, can it? If it can, the initial check should probably be kept to ensure loaded() is called even if the page is already in a 'complete' readyState.

public/embed.js Outdated Show resolved Hide resolved
@hodgesmr
Copy link
Contributor Author

hodgesmr commented Dec 8, 2022

If I understand correctly, the issue was that loaded() was called too early? I suppose document.readyState can't be 'complete' at the time this script is executed, can it? If it can, the initial check should probably be kept to ensure loaded() is called even if the page is already in a 'complete' readyState.

Probably smart to add the initial check back just in case. Added.

@ineffyble ineffyble added bug Something isn't working ui Front-end, design labels Dec 10, 2022
@Gargron Gargron merged commit 4114a70 into mastodon:main Dec 15, 2022
@hodgesmr hodgesmr deleted the embed-js-height-fix branch December 15, 2022 15:20
neatchee pushed a commit to neatchee/mastodon that referenced this pull request Dec 16, 2022
* only begin iframe reheight once document state is complete

* format

* lint fixes

* Update public/embed.js to use readystatechange event listener

Co-authored-by: Claire <claire.github-309c@sitedethib.com>

* Call loaded() if ready, otherwise add listenter

* lint fix

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
nametoolong pushed a commit to nametoolong/nuage that referenced this pull request Jan 12, 2023
* only begin iframe reheight once document state is complete

* format

* lint fixes

* Update public/embed.js to use readystatechange event listener

Co-authored-by: Claire <claire.github-309c@sitedethib.com>

* Call loaded() if ready, otherwise add listenter

* lint fix

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ui Front-end, design
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/embed.js doesn't always extend embeds height
4 participants