Preview: Add allow-forms to iframe sandbox attributes#20701
Merged
AndyButland merged 1 commit intomainfrom Oct 31, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the preview iframe's sandbox permissions by adding form submission capability. The change enables forms within the preview iframe to function properly, which is essential for testing user interactions in the preview environment.
Key changes:
- Added
allow-formsattribute to the iframe sandbox permissions
AndyButland
approved these changes
Oct 31, 2025
Contributor
AndyButland
left a comment
There was a problem hiding this comment.
Thanks @rickbutterfield - will merge this in for 17.1 and cherry-pick it to also be part of 16.4.
AndyButland
pushed a commit
that referenced
this pull request
Oct 31, 2025
Add 'allow-forms' to iframe sandbox attributes
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.
Description
When viewing a page in Preview mode and attempting to submit a form (either a standard form
POSTor Umbraco Forms), an error occurs in the browser console and the form is not submitted:Blocked form submission to '/form-submission-endpoint' because the form's frame is sandboxed and the 'allow-forms' permission is not set.Umbraco Forms allows content editors to "Save and preview" forms from the backoffice, and we are aware of users that do test their forms this way.
This PR resolves that issue by adding the
allow-formsvalue to the preview iframe'ssandboxattribute.Testing
This can be replicated on a blank install of CMS with the Starter Kit (both in 16.3.4 and 17.0.0-rc1)
Once Umbraco is installed and running:
Observe that the error listed above shows in the dev tools console.