fix: Use the form background behind the fullscreen mobile popup - #768
claude[bot] wants to merge 1 commit into
Conversation
On phones the popup fills the viewport and iOS Safari paints the status bar and bottom toolbar from the fixed container's own background, so the dark scrim shows up as grey bands around the form. Set a CSS custom property from the form-theme message (as the widget fullscreen modal already does) and consume it only inside the mobile media query, keeping the dark scrim on desktop and until the theme arrives. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RkM7Yh51Sqg4iADSZnyJXL
CI status on de68699Passing: Failing: These three failures are pre-existing and not caused by this PR. They have failed identically on every PR run in this repo since late July 2026, including dependency-only and CI-only PRs:
This PR changes 33 lines ( Note: the job logs could not be read from this environment (the log storage host is blocked), so the exact failing lines should be confirmed from the job pages. Coverage for this change: the unit spec Generated by Claude Code |
Requested by Pol Borrellas · Slack thread
Before
On iPhone Safari (iOS 18+) a popup embed fills the viewport, but the status bar and the bottom toolbar are painted dark grey. Safari derives the bar colour from the fixed
.tf-v1-popupcontainer's ownrgba(0, 0, 0, 0.75)background blended over the host page's body colour, so the form reads as a coloured band between two dark bars instead of edge to edge. This happens on any host page that usescreatePopupon a phone; Typeform Pages hit it with every popup-mode embed.After
On viewports of 480px and below, the popup container takes the form's own background colour as soon as the form reports its theme (the same
form-thememessage the widget fullscreen modal already listens to), so Safari paints the bars in the form colour and the form reads edge to edge. Desktop popups keep the dark scrim, and before the theme message arrives the scrim is unchanged on mobile too.How
createPopupregisters agetFormThemeHandlerlistener for its ownembedIdand sets a--tf-popup-backgroundcustom property on the.tf-v1-popupelement.popup.scssconsumes it only inside the existing@include mobile(max-width: 480px) block, withrgba(0, 0, 0, 0.75)as the fallback so the backdrop mixin's scrim is preserved.changeColorOpacityforces the colour opaque, like the widget fullscreen path does, so nothing from the host page bleeds through.Testing
create-popup.spec.tschecks that aform-thememessage for the popup'sembedIdsets the custom property to the opaque colour and that a message for anotherembedIdleaves it untouched.yarn jest src/factories/create-popup,yarn lintandyarn buildpass; the builtbuild/css/popup.csscontains thevar()rule inside the(max-width: 480px)media query.form-themewiththeme.backgroundColor: 'rgb(244, 208, 111)',getComputedStyle(.tf-v1-popup).backgroundColorisrgb(244, 208, 111); at a 1024px desktop viewport it staysrgba(0, 0, 0, 0.75).Slider, popover and sidetab share the same backdrop mixin and could get the same treatment in a follow-up.
QA plan
Scope: only the
.tf-v1-popupcontainer on viewports ≤480px. The JS sets a CSS custom property from the form'sform-thememessage; the CSS reads it only inside the mobile media query. Nothing else in the SDK changes.Target behaviour (iPhone, iOS 18+, Safari, Settings → Safari → "Allow Website Tinting" on)
keepSession: truepopup); rotate to landscape and back: bars keep the form colour.Regression checks
rgba(0,0,0,.75)scrim, 8px-radius card, close button in place.theme-color, not this container).data-tf-popupattribute embed (CSS auto-loaded from the CDN), JScreatePopup, ReactPopupButton.Automated
should set the popup background from the form themeincreate-popup.spec.ts(passes).Release path
Merge triggers semantic-release (patch of
@typeform/embed) and the CDN deploy ofembed.typeform.com/next, so attribute-based embeds on any site pick the change up immediately. npm consumers such as Typeform Pages need an@typeform/embed-reactbump, after which the Pages page from the report should be re-checked on a phone.🤖 Generated with Claude Code
https://claude.ai/code/session_01RkM7Yh51Sqg4iADSZnyJXL
Generated by Claude Code