Skip to content

fix: Use the form background behind the fullscreen mobile popup - #768

Draft
claude[bot] wants to merge 1 commit into
mainfrom
fix/mobile-popup-form-background
Draft

claude[bot] wants to merge 1 commit into
mainfrom
fix/mobile-popup-form-background

Conversation

@claude

@claude claude Bot commented Sep 22, 2026

Copy link
Copy Markdown

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-popup container's own rgba(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 uses createPopup on 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-theme message 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

createPopup registers a getFormThemeHandler listener for its own embedId and sets a --tf-popup-background custom property on the .tf-v1-popup element. popup.scss consumes it only inside the existing @include mobile (max-width: 480px) block, with rgba(0, 0, 0, 0.75) as the fallback so the backdrop mixin's scrim is preserved. changeColorOpacity forces the colour opaque, like the widget fullscreen path does, so nothing from the host page bleeds through.

Testing

  • Jest: new spec in create-popup.spec.ts checks that a form-theme message for the popup's embedId sets the custom property to the opaque colour and that a message for another embedId leaves it untouched. yarn jest src/factories/create-popup, yarn lint and yarn build pass; the built build/css/popup.css contains the var() rule inside the (max-width: 480px) media query.
  • Chromium (Playwright, emulated iPhone 14 at 390px): after posting form-theme with theme.backgroundColor: 'rgb(244, 208, 111)', getComputedStyle(.tf-v1-popup).backgroundColor is rgb(244, 208, 111); at a 1024px desktop viewport it stays rgba(0, 0, 0, 0.75).
  • The actual status bar / toolbar colouring can only be confirmed on a real iPhone: open a popup embed on a phone and check that the status bar and toolbar match the form background.

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-popup container on viewports ≤480px. The JS sets a CSS custom property from the form's form-theme message; 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)

  1. Typeform Page with an inline form block: tap the form so the popup opens. Once the form has loaded, the status bar and bottom toolbar show the form's background colour, no dark grey bands. Check in light and dark mode.
  2. Typeform Page button linked to a form: same result.
  3. Form whose theme has a background image or a translucent background: the bars use the theme colour as an opaque colour.
  4. Close and reopen the popup (including a keepSession: true popup); rotate to landscape and back: bars keep the form colour.
  5. Slow network: the dark scrim shows while the form loads, then switches to the form colour when the form reports its theme; no flash back to dark afterwards.

Regression checks

  1. Desktop (>480px) in Chrome, Safari, Firefox: popup unchanged, dark rgba(0,0,0,.75) scrim, 8px-radius card, close button in place.
  2. Desktop window resized across 480px with the popup open: scrim switches between dark and form colour with the breakpoint, no stale colour.
  3. iPad portrait (768px): unchanged (dark scrim, inset card).
  4. Android Chrome phone: popup still fullscreen, address bar colour unchanged (it follows theme-color, not this container).
  5. Two popups for different forms on one page: each popup takes its own form colour (message is scoped by embed id).
  6. Other embed types unchanged on phone and desktop: inline widget (including its fullscreen modal on mobile), slider, popover, sidetab.
  7. All three popup entry points behave the same: data-tf-popup attribute embed (CSS auto-loaded from the CDN), JS createPopup, React PopupButton.
  8. iPhone on iOS 17 or older: bars stay Safari's default colour (as today), no console errors.
  9. Typeform Pages builder: unaffected (no popup in editable mode).

Automated

  • Unit spec should set the popup background from the form theme in create-popup.spec.ts (passes).
  • Chromium computed-style check at 390px and 1024px (passes).
  • The repo's Cypress functional and visual suites are red on every PR since July (pre-existing), so run them locally before relying on them for this change.

Release path

Merge triggers semantic-release (patch of @typeform/embed) and the CDN deploy of embed.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-react bump, 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

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
@claude

claude Bot commented Sep 22, 2026

Copy link
Copy Markdown
Author

CI status on de68699

Passing: build-lint-test - node 24, ci-standard-checks.

Failing: deploy_preview (step yarn release:preview), functional (step yarn test:functional), visual (Visual Tests workflow, step yarn test:visual).

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 (popup.scss, create-popup.ts and its spec) and cannot affect the preview publisher or the Cypress functional/VRT infrastructure. No fix for those jobs exists in the repo yet, so this PR does not attempt one.

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 should set the popup background from the form theme in create-popup.spec.ts plus a Chromium computed-style check at 390px and 1024px.


Generated by Claude Code

This branch has not been deployed

No deployments
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.

1 participant