Skip to content

docs(surveys): specify how survey appearance fontFamily is applied - #136

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog/survey-appearance-font-family
Draft

posthog[bot] wants to merge 1 commit into
mainfrom
posthog/survey-appearance-font-family

Conversation

@posthog

@posthog posthog Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Why

A survey definition carries appearance.fontFamily, every client SDK parses it, and the surveys
spec never said what to do with it. The result is four different behaviors in shipped code, and one
SDK that parsed the field and then dropped it on the floor.

Source changes

  • PostHog/posthog-flutter#654 — support custom fontFamily in survey appearance (merged 2026-10-20), closing posthog-flutter#258. The field was parsed from the native SDKs but never used, so the built-in survey UI always rendered in the app's default font. The fix applies it once at the root of the survey sheet so plain text, button labels, and text-field input/hint all pick it up, and maps null, blank, and inherit to the default font.

Existing behavior the requirement is written against:

  • posthog-js getFontFamily (packages/browser/src/extensions/surveys/surveys-extension-utils.tsx) returns inherit verbatim for the inherit default and otherwise appends its default stack after the requested family.
  • posthog-ios SwiftUISurveyAppearance.getAppearanceWithDefaults resolves Font.customFont(family:) ?? Font.body, so an unbundled family silently falls back.
  • posthog-android carries the raw value through PostHogDisplaySurveyAppearance.fontFamily to the host UI layer rather than rendering it itself.

What changed in the spec

New surveys requirement Survey appearance font family:

  • The resolved font applies across the whole survey surface — question, description, intro screen, confirmation message, button labels, and text input value and placeholder — and changes no other appearance attribute.
  • Absent, null, empty, whitespace-only, and the case-insensitive inherit all mean unset, and unset keeps the SDK's existing default font. inherit is a CSS keyword, not a family, so a non-CSS renderer must not hand it to its font loader.
  • A family the platform cannot resolve falls back to that default font, without raising into the host app and without blocking display.
  • An SDK that builds a display model for a host or wrapper renderer passes fontFamily through unchanged.

Proposed, applied and archived on this branch per AGENTS.md. openspec validate --specs --strict totals are unchanged from main (32 passed / 32 failed); the new requirement adds one more of the pre-existing >500-character warnings that every other surveys requirement already produces.

Uncertain / worth a look

  • No acceptance coverage added. The shared harness observes enqueued events and storage, and no SDK adapter reports a resolved font, so the five scenarios live in the spec only. Worth a call on whether a renderer-introspection step belongs in the harness.
  • inherit pass-through, low confidence. The requirement has delegating SDKs forward inherit unchanged so a CSS-capable wrapper can use it as written, while posthog-flutter normalizes it on receipt. Normalizing in the native display model instead would also be defensible.
  • posthog-react-native has no fontFamily handling in packages/react-native/src/surveys/. The requirement makes that a gap rather than a choice; flagging in case it is deliberate.

Created with PostHog Desktop

🤖 Generated with Claude Code

The surveys spec never said what an SDK does with a survey definition's
appearance.fontFamily, so the shipped SDKs disagreed: posthog-js and
posthog-ios apply it with a default-font fallback, posthog-android passes
it to the host UI layer, and posthog-flutter parsed it and then ignored it
until it was applied in posthog-flutter#654.

Add a Survey appearance font family requirement covering the surfaces the
font applies to, the unset cases (absent, null, blank, and the API default
sentinel "inherit"), the silent fallback for a family the platform cannot
resolve, and pass-through for SDKs that delegate rendering.

Proposed, applied and archived on this branch per AGENTS.md.

Generated-By: PostHog Desktop
Task-Id: 0b00ba18-ec6d-474f-91d5-5f3e73f10d07
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.

0 participants