Skip to content

Improve accessibility contrast for pre-test message#180469

Merged
auto-submit[bot] merged 9 commits into
flutter:masterfrom
ashoknarayan:fix-pretest-message-contrast
Feb 5, 2026
Merged

Improve accessibility contrast for pre-test message#180469
auto-submit[bot] merged 9 commits into
flutter:masterfrom
ashoknarayan:fix-pretest-message-contrast

Conversation

@ashoknarayan

@ashoknarayan ashoknarayan commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #179181

The pre-test message "Test starting..." previously had a contrast ratio
of 2.99:1 against the background, which is below the recommended 3:1
minimum for accessibility.

This PR slightly adjusts the text color from 0xFF917FFF to 0xFF8F7FFF
to meet the minimum contrast requirement while preserving the visual
appearance.

@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. labels Jan 3, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the text color for the pre-test message to improve accessibility contrast. The change is a minor adjustment to the color value. My feedback focuses on improving code quality by extracting the magic color value into a named constant and adding documentation, in line with the repository's style guide.

Comment thread packages/flutter_test/lib/src/binding.dart

@Piinks Piinks 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.

Hey @ashoknarayan thanks for contributing! This kind of change should probably have a meetsGuideline test and use the text contrast guideline to ensure we do not regress this in a future change.

But first, can you provide more context? Is there an open issue? I am also curious about what background you are referring to. Thanks!

@ashoknarayan

Copy link
Copy Markdown
Contributor Author

Thanks for the review @Piinks!

Yes, this change is addressing an existing issue: #179181.
The “Test starting…” message is rendered by flutter_test on a very light background (0xFEF7FFFF) during test startup. With the previous text color (0xFF917FFF), the contrast ratio against that background was 2.99:1, which falls just below the recommended 3.0:1 minimum.

This PR slightly adjusts the text color to 0xFF8F7FFF, bringing the contrast above the minimum threshold while keeping the visual appearance effectively the same.

That said, I agree that this should be guarded by a test to avoid future regressions. I’ll work on adding a meetsGuideline test using the text contrast guideline for this case and update the PR accordingly.

Thanks again for the feedback!

@github-actions github-actions Bot added the a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) label Jan 23, 2026
@ashoknarayan

Copy link
Copy Markdown
Contributor Author

I’ve added a focused regression test in flutter_test that verifies the pre-test message meets the WCAG text contrast guideline, so we don’t regress this in the future.

Please let me know if you’d like the same coverage added for the post-test message as well.

@justinmc justinmc requested a review from Piinks January 27, 2026 22:58
Comment thread packages/flutter_test/test/pre_test_message_accessibility_test.dart Outdated
/// meets the minimum WCAG text contrast accessibility guideline.
testWidgets('pre-test message meets text contrast guideline', (WidgetTester tester) async {
// Pump the pre-test message widget.
await tester.pumpWidget(

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.

I think you don't need to pump widget to see the pre test text, it is already attached to the binding before this test body is run

@ashoknarayan ashoknarayan Feb 5, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The pre-test message is already attached to the render tree by TestWidgetsFlutterBinding before the test body runs. I’ve removed the manual pumpWidget and now validate the existing render tree directly using meetsGuideline(textContrastGuideline).

This should ensure we’re testing the real pre-test message and guarding against regressions.

@chunhtai

chunhtai commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

looks like there is format error

Found 1 Dart file which was formatted incorrectly.
To fix, run `dart format packages/flutter_test/test/pre_test_message_accessibility_test.dart` or:

git apply <<DONE
diff --git a/packages/flutter_test/test/pre_test_message_accessibility_test.dart b/packages/flutter_test/test/pre_test_message_accessibility_test.dart
index ae0a9cdf960..00000000000 100644
--- a/packages/flutter_test/test/pre_test_message_accessibility_test.dart
+++ b/packages/flutter_test/test/pre_test_message_accessibility_test.dart
@@ -10,9 +10,7 @@ void main() {
   testWidgets('pre-test message meets text contrast guideline', (WidgetTester tester) async {
     // The pre-test message is already attached to the render tree by the
     // TestWidgetsFlutterBinding before this test runs, so no pumpWidget is needed.
-    await expectLater(
-      tester,
-      meetsGuideline(textContrastGuideline),
-    );
+    await expectLater(tester, meetsGuideline(textContrastGuideline));
   });
 }
DONE

otherwise the change lgtm

@Piinks Piinks 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.

LGTM

@chunhtai chunhtai 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.

LGTM

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 5, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Feb 5, 2026
Merged via the queue into flutter:master with commit 3e034fc Feb 5, 2026
69 of 70 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 5, 2026
LongCatIsLooong pushed a commit to LongCatIsLooong/flutter that referenced this pull request Feb 6, 2026
Fixes flutter#179181

The pre-test message "Test starting..." previously had a contrast ratio
of 2.99:1 against the background, which is below the recommended 3:1
minimum for accessibility.

This PR slightly adjusts the text color from 0xFF917FFF to 0xFF8F7FFF
to meet the minimum contrast requirement while preserving the visual
appearance.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 6, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 6, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 7, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 8, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 8, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Feb 8, 2026
Roll Flutter from f916dd6887bf to e8f9dc50356d (34 revisions)

flutter/flutter@f916dd6...e8f9dc5

2026-02-08 [email protected] Roll Skia from 9325111e6ee4 to b7db9f35f0f2 (1 revision) (flutter/flutter#182062)
2026-02-08 [email protected] Roll Skia from 3167229206b5 to 9325111e6ee4 (1 revision) (flutter/flutter#182061)
2026-02-08 [email protected] Roll Fuchsia Linux SDK from sYqpDF9l9-kldd9_Q... to iqtwdXlgKIyZkL5Li... (flutter/flutter#182058)
2026-02-08 [email protected] Roll Skia from ae78024b261e to 3167229206b5 (1 revision) (flutter/flutter#182055)
2026-02-07 [email protected] Roll Dart SDK from ad6368edbe02 to 965b51c219d3 (1 revision) (flutter/flutter#182050)
2026-02-07 [email protected] Roll Skia from a471f253b941 to ae78024b261e (1 revision) (flutter/flutter#182049)
2026-02-07 [email protected] Roll Fuchsia Linux SDK from IOzzhWfhdzhu3zHsz... to sYqpDF9l9-kldd9_Q... (flutter/flutter#182043)
2026-02-07 [email protected] Roll Dart SDK from 02092faa97c5 to ad6368edbe02 (2 revisions) (flutter/flutter#182040)
2026-02-07 [email protected] Roll Skia from 9a983f6c2c06 to a471f253b941 (24 revisions) (flutter/flutter#182039)
2026-02-07 [email protected] Add buffer around rerasterized input to fragment shaders to maintain coordinate space when clipped (flutter/flutter#181743)
2026-02-07 [email protected] Update Flutter's style guide for dot shorthands and extension methods (flutter/flutter#181934)
2026-02-06 [email protected] Manual roll Skia from 39aa2a70213a to 9a983f6c2c06 (flutter/flutter#181986)
2026-02-06 [email protected] Update doc in foundation to match the style guide (flutter/flutter#181972)
2026-02-06 [email protected] Roll Dart SDK from ec674bdb3ae4 to 02092faa97c5 (11 revisions) (flutter/flutter#182017)
2026-02-06 [email protected] Roll Packages from c197455 to 7805d3e (4 revisions) (flutter/flutter#182016)
2026-02-06 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[cupertino.dart] Implement CupertinoMenuAnchor and CupertinoMenuItem using RawMenuAnchor (#174695)" (flutter/flutter#182010)
2026-02-06 [email protected] Update Dart SDK to 3.12 beta1 (flutter/flutter#181948)
2026-02-06 [email protected] [cupertino.dart] Implement CupertinoMenuAnchor and CupertinoMenuItem using RawMenuAnchor (flutter/flutter#174695)
2026-02-06 [email protected] `flutter_tool` : Remove redundant enum types inside the enum definition scope (flutter/flutter#181910)
2026-02-06 [email protected] Roll pub packages (flutter/flutter#181973)
2026-02-05 [email protected] Roll Fuchsia Linux SDK from J2QdLcY2gyt4NP_xV... to IOzzhWfhdzhu3zHsz... (flutter/flutter#181971)
2026-02-05 [email protected] Directly generate a Mach-O dynamic library using gen_snapshot. [reland] (flutter/flutter#181539)
2026-02-05 [email protected] macOS: Implement tooltip window controller (flutter/flutter#180895)
2026-02-05 [email protected] Constrain RawAutocomplete options by soft keyboard (flutter/flutter#181930)
2026-02-05 [email protected] Roll Skia from 079d092f49e6 to 39aa2a70213a (1 revision) (flutter/flutter#181970)
2026-02-05 [email protected] perf: web ui loadFontFromList (flutter/flutter#181440)
2026-02-05 [email protected] Improve accessibility contrast for pre-test message (flutter/flutter#180469)
2026-02-05 [email protected] Roll pub packages (flutter/flutter#181965)
2026-02-05 [email protected] Roll Skia from 8543ce512d5c to 079d092f49e6 (8 revisions) (flutter/flutter#181964)
2026-02-05 [email protected] Add `clearError` API to Form and FormFieldState (flutter/flutter#180752)
2026-02-05 [email protected] Bump minimum required Xcode version to 15 and recommended to 16 (flutter/flutter#180531)
2026-02-05 [email protected] Rename "widgetTester" parameter to "tester" in "WidgetTesterCallback" (flutter/flutter#180944)
2026-02-05 [email protected] Roll Packages from 3bddf2c to c197455 (3 revisions) (flutter/flutter#181962)
2026-02-05 [email protected] Temporarily remove the Pixel 9/API 36 device from the Firebase Test Lab tests. (flutter/flutter#181956)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

...
flutter-zl pushed a commit to flutter-zl/flutter that referenced this pull request Feb 10, 2026
Fixes flutter#179181

The pre-test message "Test starting..." previously had a contrast ratio
of 2.99:1 against the background, which is below the recommended 3:1
minimum for accessibility.

This PR slightly adjusts the text color from 0xFF917FFF to 0xFF8F7FFF
to meet the minimum contrast requirement while preserving the visual
appearance.
rickhohler pushed a commit to rickhohler/flutter that referenced this pull request Feb 19, 2026
Fixes flutter#179181

The pre-test message "Test starting..." previously had a contrast ratio
of 2.99:1 against the background, which is below the recommended 3:1
minimum for accessibility.

This PR slightly adjusts the text color from 0xFF917FFF to 0xFF8F7FFF
to meet the minimum contrast requirement while preserving the visual
appearance.
mboetger pushed a commit to mboetger/flutter that referenced this pull request Mar 26, 2026
Fixes flutter#179181

The pre-test message "Test starting..." previously had a contrast ratio
of 2.99:1 against the background, which is below the recommended 3:1
minimum for accessibility.

This PR slightly adjusts the text color from 0xFF917FFF to 0xFF8F7FFF
to meet the minimum contrast requirement while preserving the visual
appearance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Testing][A11y] Contrast check fails for "Test starting" in flutter_test binding

3 participants