Skip to content

fix(settings): resize the settings iframe to its reported height#5891

Open
timar wants to merge 1 commit into
mainfrom
fix/settings-iframe-height
Open

fix(settings): resize the settings iframe to its reported height#5891
timar wants to merge 1 commit into
mainfrom
fix/settings-iframe-height

Conversation

@timar

@timar timar commented Jul 21, 2026

Copy link
Copy Markdown
Member
  • Resolves: #
  • Target version: main

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

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Documentation (manuals or wiki) has been updated or is not required

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
timar requested review from elzody and juliusknorr as code owners July 21, 2026 10:35
@timar
timar requested review from Copilot and removed request for elzody and juliusknorr July 21, 2026 10:36
@timar
timar requested review from elzody and juliusknorr July 21, 2026 10:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.data as JSON when it arrives as a string, then handle Iframe_Height messages.
  • Verify postMessage sender origin against the iframe URL’s origin before acting on messages.
  • Set iframe height via style.height and add a CSS min-height fallback before the first resize message arrives.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/CoolFrame.vue
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
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@elzody

elzody commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

The Cypress tests should pass again after a rebase onto the latest main branch. Could you take care of that?

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.

3 participants