Skip to content

feat(surveys): add Skip button to optional questions - #758

Open
gantoine wants to merge 3 commits into
mainfrom
posthog/survey-skip-button
Open

gantoine wants to merge 3 commits into
mainfrom
posthog/survey-skip-button

Conversation

@gantoine

@gantoine gantoine commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

💡 Motivation and Context

Part of #757 (the Dart side; bridging skipButtonText from the native SDKs is a follow-up).

Optional survey questions in Flutter keep Submit enabled when nothing is answered, and that empty Submit quietly counts as a skip. Optional questions that auto-submit have no way to be skipped at all. This ports the behavior from PostHog/posthog-js#5995, PostHog/posthog-ios#1146 and PostHog/posthog-android#1030:

  • Optional open text, rating, single choice and multiple choice questions keep Submit disabled until answered, using the same rule as required questions. For optional open text, whitespace-only counts as unanswered.
  • A separate, low-emphasis Skip button sits below Submit on optional questions, whether or not they're answered. Optional auto-submit questions (rating skipSubmitButton, single choice without an open choice) show Skip on its own.
  • Skip sends what an empty Submit already sent, so stored responses don't change: "" for open text, null for rating, single choice and multiple choice. Skipping after answering discards the answer.
  • PostHogDisplaySurveyAppearance gains skipButtonText, parsed from the native appearance map. The label falls back to "Skip" when it's missing or empty.
  • Required and link questions are unchanged.

Not in this PR: the native bridge doesn't send skipButtonText yet. The field only exists in the unreleased posthog-ios#1146 and posthog-android#1030, so reading it now would break the build against the released 4.x SDKs. Until a follow-up raises the minimum native versions and adds it to PostHogDisplaySurveyExt.kt and PostHogDisplaySurvey+Dict.swift, Flutter always shows "Skip": custom and translated labels don't reach Flutter yet.

💚 How did you test it?

CI passes (format, analyze, API snapshot, tests). The tests:

  • New test/survey_skip_button_test.dart, covering each type (open, rating, single, multiple):
    • Submit disabled until answered.
    • Skip sends the empty value, also after answering.
    • Custom label, and an empty label falls back to "Skip".
    • No Skip on required questions.
  • It also covers whitespace-only open text, Skip on auto-submit rating and single choice, and skipButtonText parsing (present, absent, null appearance).
  • survey_optional_questions_test.dart and survey_optional_choice_test.dart asserted the old behavior (Submit enabled on an empty optional question). They now assert Submit is disabled and Skip sends the empty value.
  • Ran the example app on Android (released posthog-android 4.2.x natively, Dart rendering from this branch) on a Pixel 7 emulator (API 36), against a local mock server serving one survey with four optional questions (open text, rating, single choice, multiple choice): Submit stays disabled on each until it's answered, Skip shows below it, typing an answer then tapping Skip moves on, and answering then Submit moves on through to the thank-you screen.
  • Ran the same flow on an iPhone 18 Pro simulator (iOS 27.2, released posthog-ios 4.2.x natively) with the same result.

Demo:

flutter-ios-demo.mp4
flutter-demo.mp4

📝 Checklist

  • All commits are signed (see Commit signing)
  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Written with Claude Code (a Sonnet subagent implemented it; the diff was reviewed in the driving session). The behavior follows the web, React Native, iOS and Android implementations linked above. Flutter keeps its existing skip values ("" for open text, null for the rest) instead of switching to web's [] for multiple choice. The bridge follow-up was split out so this can ship without waiting for the native releases.

🤖 Generated with Claude Code

Optional open text, rating, single choice and multiple choice questions now
disable Submit until answered and show a separate Skip button. Adds the
skipButtonText appearance field, parsed from the native appearance map.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gantoine gantoine self-assigned this Dec 2, 2026
@gantoine gantoine closed this Dec 2, 2026
@gantoine gantoine reopened this Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

posthog-flutter Compliance Report

Date: 2026-12-04T14:35:19.912132+00:00
Duration: 369667ms

✅ All Tests Passed!

232/232 tests passed


Capture_V1 Tests

✅ 105/105 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 196ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 126ms
Required Headers.Has Authorization Bearer Header ✅ 119ms
Required Headers.Has Content Type Json ✅ 119ms
Required Headers.Has Posthog Sdk Info Format ✅ 119ms
Required Headers.Has Posthog Attempt Header ✅ 118ms
Required Headers.Has Posthog Request Id ✅ 118ms
Required Headers.Has Posthog Request Timestamp ✅ 120ms
Required Headers.Has User Agent ✅ 119ms
Body Format.Body Has Created At And Batch ✅ 119ms
Body Format.No Api Key In Body ✅ 117ms
Body Format.No Sent At In Body ✅ 118ms
Event Format.Event Has Required Root Fields ✅ 119ms
Event Format.Event Uuid Is Valid ✅ 116ms
Event Format.Event Timestamp Is Rfc3339 ✅ 119ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 118ms
Event Format.Distinct Id Is String ✅ 118ms
Event Format.Distinct Id At Root Not Properties ✅ 117ms
Event Format.Custom Properties Preserved ✅ 119ms
Event Format.Set Properties Preserved ✅ 119ms
Event Format.Set Once Properties Preserved ✅ 117ms
Event Format.Groups Properties Preserved ✅ 117ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 116ms
Event Format.Event Has Required Root Fields Batch ✅ 121ms
Event Format.Event Uuid Is Valid Batch ✅ 121ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 122ms
Event Format.Distinct Id Is String Batch ✅ 122ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 121ms
Event Format.Custom Properties Preserved Batch ✅ 120ms
Event Format.Set Properties Preserved Batch ✅ 126ms
Event Format.Set Once Properties Preserved Batch ✅ 121ms
Event Format.Groups Properties Preserved Batch ✅ 122ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 121ms
Batch Behavior.Multiple Events In Single Batch ✅ 126ms
Batch Behavior.Batch Envelope Smoke ✅ 124ms
Batch Behavior.Flush With No Events Sends Nothing ✅ 109ms
Batch Behavior.Flush At Triggers Batch ✅ 1016ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 117ms
Deduplication.Generates Unique Uuids ✅ 125ms
Deduplication.Different Events Same Content Different Uuids ✅ 121ms
Deduplication.Preserves Uuid On Retry ✅ 5125ms
Deduplication.Preserves Timestamp On Retry ✅ 5123ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5126ms
Deduplication.No Duplicate Events In Batch ✅ 127ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 116ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 10126ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 5123ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2230ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 5123ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 115ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 120ms
Response Format Validation.Success No Retry After When All Ok ✅ 117ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 119ms
Response Format Validation.Success No Retry After When Drop Only ✅ 119ms
Response Format Validation.Response Echoes Request Id ✅ 116ms
Retry Behavior.Retries On 408 ✅ 5122ms
Retry Behavior.Retries On 500 ✅ 5122ms
Retry Behavior.Retries On 503 ✅ 5123ms
Retry Behavior.Retries On 504 ✅ 5122ms
Retry Behavior.Retries On 404 ✅ 5124ms
Retry Behavior.Retries On 429 ✅ 5123ms
Retry Behavior.Retries On 502 ✅ 5122ms
Retry Behavior.Retryable Errors Have Retry After ✅ 2120ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 8126ms
Retry Behavior.Does Not Retry On 400 ✅ 2118ms
Retry Behavior.Does Not Retry On 401 ✅ 2119ms
Retry Behavior.Does Not Retry On 402 ✅ 2119ms
Retry Behavior.Does Not Retry On 413 ✅ 2118ms
Retry Behavior.Does Not Retry On 415 ✅ 2119ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 2119ms
Retry Behavior.Implements Backoff ✅ 12128ms
Partial Batch Handling.Handles 200 Full Success ✅ 2118ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3124ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3121ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3122ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 5120ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 5120ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 5126ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 5124ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 5120ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 5124ms
Partial Batch Handling.Respects Retry After On Partial ✅ 5124ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3122ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3125ms
Compression.Sends Gzip Content Encoding ✅ 117ms
Compression.No Content Encoding When Disabled ✅ 115ms
Compression.Compressed Body Is Decompressible ✅ 115ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 2117ms
Event Options.Cookieless Mode Override ✅ 116ms
Event Options.Disable Skew Correction Override ✅ 115ms
Event Options.Process Person Profile Override ✅ 115ms
Event Options.Product Tour Id Override ✅ 115ms
Event Options.Unset Options Omitted ✅ 116ms
Event Options.Options Override In Batch ✅ 119ms
Event Options.Unknown Option Passes Through ✅ 115ms
Event Options.Option Value Is Not Converted ✅ 115ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 115ms
Event Options.Option Wins Over Legacy Property ✅ 115ms
Event Options.Legacy Property Fills Unset Option ✅ 114ms
Event Options.Null Option Falls Back To Legacy Property ✅ 115ms
Property Layers.Caller Property Beats Registered Property ✅ 114ms
Property Layers.Before Send Runs Last ✅ 116ms
Fail Open.Empty Api Key Sends Nothing ✅ 1111ms
Fail Open.Personal Api Key Sends Nothing ✅ 1112ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 115ms

Capture_Ai_V1 Tests

✅ 110/110 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 116ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 115ms
Endpoint And Method.Capture Does Not Reroute Ai Named Events ✅ 115ms
Endpoint And Method.Capture Ai Does Not Reroute Non Ai Events ✅ 114ms
Lane Isolation.Failing Ai Lane Does Not Delay Analytics ✅ 5127ms
Required Headers.Has Authorization Bearer Header ✅ 115ms
Required Headers.Has Content Type Json ✅ 115ms
Required Headers.Has Posthog Sdk Info Format ✅ 114ms
Required Headers.Has Posthog Attempt Header ✅ 114ms
Required Headers.Has Posthog Request Id ✅ 115ms
Required Headers.Has Posthog Request Timestamp ✅ 114ms
Required Headers.Has User Agent ✅ 114ms
Body Format.Body Has Created At And Batch ✅ 114ms
Body Format.No Api Key In Body ✅ 115ms
Body Format.No Sent At In Body ✅ 114ms
Event Format.Event Has Required Root Fields ✅ 114ms
Event Format.Event Uuid Is Valid ✅ 114ms
Event Format.Event Timestamp Is Rfc3339 ✅ 115ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 114ms
Event Format.Distinct Id Is String ✅ 115ms
Event Format.Distinct Id At Root Not Properties ✅ 115ms
Event Format.Custom Properties Preserved ✅ 114ms
Event Format.Set Properties Preserved ✅ 115ms
Event Format.Set Once Properties Preserved ✅ 115ms
Event Format.Groups Properties Preserved ✅ 114ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 115ms
Event Format.Event Has Required Root Fields Batch ✅ 119ms
Event Format.Event Uuid Is Valid Batch ✅ 118ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 118ms
Event Format.Distinct Id Is String Batch ✅ 119ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 118ms
Event Format.Custom Properties Preserved Batch ✅ 118ms
Event Format.Set Properties Preserved Batch ✅ 119ms
Event Format.Set Once Properties Preserved Batch ✅ 119ms
Event Format.Groups Properties Preserved Batch ✅ 119ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 119ms
Batch Behavior.Multiple Events In Single Batch ✅ 124ms
Batch Behavior.Batch Envelope Smoke ✅ 121ms
Batch Behavior.Flush At Triggers Batch ✅ 1013ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 115ms
Deduplication.Generates Unique Uuids ✅ 123ms
Deduplication.Different Events Same Content Different Uuids ✅ 117ms
Deduplication.Preserves Uuid On Retry ✅ 5117ms
Deduplication.Preserves Timestamp On Retry ✅ 5121ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5125ms
Deduplication.No Duplicate Events In Batch ✅ 123ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 115ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 10125ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 5118ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2231ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 5120ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 116ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 119ms
Response Format Validation.Success No Retry After When All Ok ✅ 118ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 118ms
Response Format Validation.Success No Retry After When Drop Only ✅ 117ms
Response Format Validation.Response Echoes Request Id ✅ 114ms
Retry Behavior.Retries On 408 ✅ 5121ms
Retry Behavior.Retries On 500 ✅ 5122ms
Retry Behavior.Retries On 503 ✅ 5121ms
Retry Behavior.Retries On 504 ✅ 5122ms
Retry Behavior.Retries On 404 ✅ 5121ms
Retry Behavior.Retries On 429 ✅ 5121ms
Retry Behavior.Retries On 502 ✅ 5121ms
Retry Behavior.Retryable Errors Have Retry After ✅ 2119ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 8124ms
Retry Behavior.Does Not Retry On 400 ✅ 2118ms
Retry Behavior.Does Not Retry On 401 ✅ 2119ms
Retry Behavior.Does Not Retry On 402 ✅ 2118ms
Retry Behavior.Does Not Retry On 413 ✅ 2118ms
Retry Behavior.Does Not Retry On 415 ✅ 2119ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 2117ms
Retry Behavior.Implements Backoff ✅ 12127ms
Partial Batch Handling.Handles 200 Full Success ✅ 2117ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3123ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3120ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3121ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 5122ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 5122ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 5124ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 5122ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 5122ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 5123ms
Partial Batch Handling.Respects Retry After On Partial ✅ 5122ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3120ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3124ms
Compression.Sends Gzip Content Encoding ✅ 115ms
Compression.No Content Encoding When Disabled ✅ 114ms
Compression.Compressed Body Is Decompressible ✅ 114ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 2118ms
Event Options.Cookieless Mode Override ✅ 114ms
Event Options.Disable Skew Correction Override ✅ 114ms
Event Options.Process Person Profile Override ✅ 113ms
Event Options.Product Tour Id Override ✅ 114ms
Event Options.Unset Options Omitted ✅ 114ms
Event Options.Options Override In Batch ✅ 117ms
Event Options.Unknown Option Passes Through ✅ 114ms
Event Options.Option Value Is Not Converted ✅ 114ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 112ms
Event Options.Option Wins Over Legacy Property ✅ 113ms
Event Options.Legacy Property Fills Unset Option ✅ 114ms
Event Options.Null Option Falls Back To Legacy Property ✅ 113ms
Event Size.Event Over Ceiling Is Not Sent ✅ 3890ms
Event Size.Over Ceiling Drop Is Reported Or Logged Without Content ✅ 2171ms
Event Size.Batches Close Before Byte Target ✅ 5952ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 116ms
Property Layers.Caller Property Beats Registered Property ✅ 113ms
Property Layers.Before Send Runs Last ✅ 113ms
Fail Open.Empty Api Key Sends Nothing ✅ 1110ms
Fail Open.Personal Api Key Sends Nothing ✅ 1111ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 18ms
Request Payload.Flags Request Uses V2 Query Param ✅ 12ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 9ms
Request Payload.Flags Request Omits Authorization Header ✅ 9ms
Request Payload.Token In Flags Body Matches Init ✅ 9ms
Request Payload.Groups Round Trip ✅ 10ms
Request Payload.Groups Default To Empty Object ✅ 9ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 8ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 9ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 8ms
Request Lifecycle.No Flags Request On Init Alone ✅ 4ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 112ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 17ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 10ms
Retry Behavior.Retries Flags On 502 ✅ 316ms
Retry Behavior.Retries Flags On 504 ✅ 315ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 117ms

@gantoine
gantoine marked this pull request as ready for review December 3, 2026 21:47
@gantoine
gantoine requested a review from a team as a code owner December 3, 2026 21:47
@veria-ai

veria-ai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

PR overview

No security issues were found in this pull request.

Reviews

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The Dart survey UI changes (disabled Submit until answered, separate low-emphasis SurveySkipButton on optional open text, rating, single choice, and multiple choice questions including auto-submit, and answer discarding on Skip) are clean and well-tested.

One Concern on staged release / changelog accuracy (inline on .changeset/quiet-owls-skip.md), along with two optional Suggestions and a pre-existing cross-SDK Follow-up inline.

Follow-up (outside this repository): skipButtonText is not yet present in PostHog/posthog (products/surveys/backend/api/survey.py, products/surveys/backend/translation.py, frontend/src/scenes/surveys/surveyVersionRequirements.ts) or PostHog/posthog.com (contents/docs/surveys/creating-surveys.mdx). Tracking backend schema/translation/editor support, minimum SDK version requirements, and survey docs updates alongside stacked #759 and the peer SDK PRs (posthog-ios#1146, posthog-android#1030, posthog-js#5995) will be needed for end-to-end customer configuration (Surveys / Client Libraries teams).

AI-assisted review.

Comment thread .changeset/quiet-owls-skip.md Outdated
"posthog_flutter": minor
---

Optional open text, rating, single choice and multiple choice survey questions now show a separate Skip button below Submit, and Submit stays disabled until the question is answered. Skip sends the empty response (`""` for open text, no answer for the other types) and discards any answer already entered. Optional questions that submit automatically also show Skip. Adds `skipButtonText` to `PostHogDisplaySurveyAppearance`; the label defaults to "Skip".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Concern: Releasing #758 ahead of stacked #759 ships an untranslatable hardcoded "Skip" label on localized mobile surveys and an inaccurate changeset citing internal PostHogDisplaySurveyAppearance.

Trigger → actual → expected:

  • Merging feat(surveys): add Skip button to optional questions #758 with this minor changeset triggers an automated posthog_flutter release on pub.dev (RELEASING.md) ahead of stacked draft PR feat(surveys): pass skipButtonText from the native SDKs #759 (5938bb74, blocked on unreleased posthog-ios#1146 and posthog-android#1030).
  • On merge base (28c95988), optional questions in non-English or translated mobile apps (survey translations shipped in 6.0.0 via native SurveyTranslationApplier / PostHogSurvey+Display) advanced via the localized question.buttonText or appearance.submitButtonText, both already forwarded by the native bridges.
  • Releasing feat(surveys): add Skip button to optional questions #758 alone disables that localized Submit button and displays a hardcoded English "Skip" button that customers cannot customize or translate on iOS or Android (no Dart override API exists), because neither PostHogDisplaySurveyExt.kt:67-93 nor PostHogDisplaySurvey+Dict.swift:55-125 forwards "skipButtonText" yet (a['skipButtonText'] in posthog_display_survey.dart:110 is always null at runtime until feat(surveys): pass skipButtonText from the native SDKs #759 ships).
  • In addition, this changeset advertises "Adds skipButtonText to PostHogDisplaySurveyAppearance; the label defaults to 'Skip'", even though PostHogDisplaySurveyAppearance is an internal lib/src/surveys/models/ class not exported from package:posthog_flutter/posthog_flutter.dart (absent from posthog_flutter/lib/posthog_flutter.dart and api/posthog_flutter.api.json, unlike posthog-ios#1146 and posthog-android#1030 where it is public API) and omits that neither native bridge passes skipButtonText yet.

Governing contract: RELEASING.md and PostHog SDK Guidelines (Keep changelogs and version bumps accurate) require customer-facing release notes to accurately reflect observable changes and affected platforms. For precedent in this repo, see posthog_flutter/CHANGELOG.md:13 (6.2.0 / 22e6f33), which explicitly disclosed when native bridge forwarding was still pending ("Android keeps showing the bottom sheet until posthog-android passes the position through") and did not reference internal lib/src/ types.

Recommendation:

),
if (widget.optional)
SurveySkipButton(
onPressed: () => widget.onSubmit(''),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follow-up: Pre-existing cross-SDK divergence worth a policy decision in PostHog/sdk-specs (not a regression or merge blocker for #758 — merge base 28c95988 already emitted '' for empty optional open-text submit, matching posthog-js#5995).

Observed behavior across the native bridges and backend:

  • Skipping an optional open-text question sends '' → Android (PostHogFlutterSurveysDelegate.kt:168-169) wraps it as PostHogSurveyResponse.Text("") and iOS (PosthogFlutterPlugin.swift:811-812) wraps it as .openEnded("").
  • In both delegated native cores (PostHogSurveysIntegration.kt:1036,1060-1062 and PostHogSurveyIntegration.swift:794,817-829), "" is non-null, so surveyHasResponses returns true. If a user skips Q0 (optional open text) and then dismisses Q1 without answering anything, survey dismissed is captured with $survey_partially_completed: true and $survey_response_<id>: "".
  • In PostHog/posthog (products/surveys/backend/responses/fetch_rows.py:125-128), RESPONSE_EVENT_FILTER includes survey dismissed events where $survey_partially_completed = 'true', counting the skip-then-dismiss as a partial response row.
  • By contrast, Flutter's rating/choice skip sends null, and both delegated native cores' own UIs send null/nil on open-text skip (posthog-android#1030 SurveySheet.kt:189, posthog-ios#1146 QuestionTypes.swift:138), keeping $survey_partially_completed: false.

Because posthog-js#5995 (browser & RN) also sends "", consider opening a cross-SDK policy decision in PostHog/sdk-specs (Client Libraries / Surveys teams) on whether skipped optional open-text should emit null/omitted or "" (and whether surveyHasResponses should treat "" as unanswered) rather than changing it ad hoc here.

@dustinbyrne
dustinbyrne requested a review from a team December 3, 2026 22:15
A blank skipButtonText now shows "Skip" instead of an empty button. Adds tests for optional choice questions with an open choice (Submit gating, Skip discarding the text, auto-submit), deselecting an optional rating or choice, and an optional link question having no Skip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gantoine
gantoine requested a review from dustinbyrne December 4, 2026 14:24
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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.

2 participants