Skip to content

fix(surveys): use the survey text color for multiple-choice option labels - #592

Open
ioannisj wants to merge 1 commit into
mainfrom
fix/584
Open

ioannisj wants to merge 1 commit into
mainfrom
fix/584

Conversation

@ioannisj

@ioannisj ioannisj commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Fixes #584.

Multiple-choice option labels in the Flutter survey widget were hardcoded to Colors.black (50% alpha when unselected), so on a dark survey background like #1a1a2e the options were nearly invisible. The "Other" option was readable because that branch already used appearance.choiceButtonTextColor, which is what made the reporter's screenshot look so odd.

Switches the plain-choice label in posthog_flutter/lib/src/surveys/widgets/survey_choice_button.dart to appearance.choiceButtonTextColor as well, so it follows the textColor override or the auto-contrast of backgroundColor like the border, the check icon and every other text element in the popover.

The issue asks for textSubtleColor instead. In posthog-js option labels take --ph-survey-input-text-color (packages/browser/src/extensions/surveys/survey.css:58), which is inputTextColor or the contrast of inputBackground; textSubtleColor only drives the hover border, the "Other" placeholder and the scrollbar. Flutter draws the choice buttons straight over the survey background rather than an input background, so the primary text colour is the matching contrast here, and textSubtleColor isn't bridged from the native SDKs anyway.

Worth a follow-up to decide whether the Flutter choice buttons should pick up inputBackground/inputTextColor like the web ones do. Out of scope for this fix.

💚 How did you test it?

  • Added posthog_flutter/test/survey_choice_button_color_test.dart, which renders the button on a dark background and asserts the label colour is white (selected) and white at 50% alpha (unselected). I confirmed it fails on main and passes with the fix.
  • Full flutter test suite passes (651 tests), flutter analyze and dart format are clean.
  • Ran the example app on an iPhone 16 simulator against a mock PostHog server serving a dark multiple-choice survey. Before the fix the three plain options were unreadable, after it they render in white like the "Other" row.

📝 Checklist

  • 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

DRI: @ioannisj
Autonomy: Human-driven (agent-assisted)

@ioannisj ioannisj self-assigned this Sep 18, 2026
@greptile-apps

greptile-apps Bot commented Sep 18, 2026

Copy link
Copy Markdown

Retrigger

The PR appears safe to merge with no actionable issues identified.

Reviews (1) · Last reviewed commit: "fix(surveys): use the survey text color ..."

@github-actions

Copy link
Copy Markdown
Contributor

posthog-flutter Compliance Report

Date: 2026-09-18 03:18:27 UTC
Duration: 96530ms

✅ All Tests Passed!

45/45 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 130ms
Format Validation.Event Has Uuid 114ms
Format Validation.Event Has Lib Properties 112ms
Format Validation.Distinct Id Is String 111ms
Format Validation.Token Is Present 112ms
Format Validation.Custom Properties Preserved 113ms
Format Validation.Event Has Timestamp 113ms
Retry Behavior.Retries On 503 5324ms
Retry Behavior.Does Not Retry On 400 2114ms
Retry Behavior.Does Not Retry On 401 2114ms
Retry Behavior.Respects Retry After Header 8121ms
Retry Behavior.Implements Backoff 15429ms
Retry Behavior.Retries On 500 5221ms
Retry Behavior.Retries On 502 5221ms
Retry Behavior.Retries On 504 5221ms
Retry Behavior.Max Retries Respected 15439ms
Deduplication.Generates Unique Uuids 118ms
Deduplication.Preserves Uuid On Retry 5220ms
Deduplication.Preserves Uuid And Timestamp On Retry 10322ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 5225ms
Deduplication.No Duplicate Events In Batch 117ms
Deduplication.Different Events Have Different Uuids 112ms
Compression.Sends Gzip When Enabled 112ms
Batch Format.Uses Proper Batch Structure 110ms
Batch Format.Flush With No Events Sends Nothing 107ms
Batch Format.Multiple Events Batched Together 117ms
Error Handling.Does Not Retry On 403 2113ms
Error Handling.Does Not Retry On 413 2114ms
Error Handling.Retries On 408 5220ms

Feature_Flags Tests

16/16 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 10ms
Request Payload.Flags Request Uses V2 Query Param 6ms
Request Payload.Flags Request Hits Flags Path Not Decide 6ms
Request Payload.Flags Request Omits Authorization Header 6ms
Request Payload.Token In Flags Body Matches Init 6ms
Request Payload.Groups Round Trip 7ms
Request Payload.Groups Default To Empty Object 7ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It 6ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 6ms
Request Payload.Disable Geoip Omitted Defaults To False 7ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 6ms
Request Lifecycle.No Flags Request On Init Alone 2ms
Request Lifecycle.No Flags Request On Normal Capture 109ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 11ms
Request Lifecycle.Mock Response Value Is Returned To Caller 6ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 112ms

@ioannisj
ioannisj marked this pull request as ready for review September 18, 2026 13:47
@ioannisj
ioannisj requested a review from a team as a code owner September 18, 2026 13:47
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.

textSubtleColor from survey appearance not applied to multiple choice options

2 participants