fix(settings): resize the settings iframe to its reported height#5891
Open
timar wants to merge 1 commit into
Open
fix(settings): resize the settings iframe to its reported height#5891timar wants to merge 1 commit into
timar wants to merge 1 commit into
Conversation
The embedded settings page posts an Iframe_Height message so the parent can grow the iframe to fit its content. The handler read event.data as an object, but the message arrives as a JSON string, so data.MessageId was always undefined and the resize never ran, leaving a short frame with an inner scrollbar. Parse the string before inspecting it. Also set style.height instead of the deprecated height attribute, which ignores a "<n>px" value, verify the sender origin, and add a min-height fallback for the moment before the first height message arrives. Signed-off-by: Andras Timar <andras.timar@collabora.com>
timar
requested review from
Copilot
and removed request for
elzody and
juliusknorr
July 21, 2026 10:36
There was a problem hiding this comment.
Pull request overview
Fixes iframe auto-resizing for the embedded settings page by correctly parsing postMessage payloads and applying the reported height to the iframe element, improving UX by avoiding inner scrollbars.
Changes:
- Parse
event.dataas JSON when it arrives as a string, then handleIframe_Heightmessages. - Verify
postMessagesender origin against the iframe URL’s origin before acting on messages. - Set iframe height via
style.heightand add a CSSmin-heightfallback before the first resize message arrives.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
elzody
approved these changes
Jul 22, 2026
Comment on lines
+96
to
+99
| // Only trust messages from the Collabora origin that serves the iframe. | ||
| if (event.origin !== new URL(this.iframeUrl).origin) { | ||
| return | ||
| } |
Collaborator
There was a problem hiding this comment.
We are adding post message origin verification in #5874, but for now this is fine to stay to get this fix in. I can handle any merge conflicts or adjustments that need taken care of later once the other PR is merged. ^^
Just adding this here for reference.
Collaborator
|
The Cypress tests should pass again after a rebase onto the latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The embedded settings page posts an Iframe_Height message so the parent can grow the iframe to fit its content. The handler read event.data as an object, but the message arrives as a JSON string, so data.MessageId was always undefined and the resize never ran, leaving a short frame with an inner scrollbar. Parse the string before inspecting it.
Also set style.height instead of the deprecated height attribute, which ignores a "px" value, verify the sender origin, and add a min-height fallback for the moment before the first height message arrives.
Checklist