Skip to content

Apply error text colour to placeholders in fields with errors - #3632

Open
vivi-the-going-merry[bot] wants to merge 3 commits into
masterfrom
fix/issue-6929-error-placeholder-color
Open

vivi-the-going-merry[bot] wants to merge 3 commits into
masterfrom
fix/issue-6929-error-placeholder-color

Conversation

@vivi-the-going-merry

Copy link
Copy Markdown
Contributor

Closes Strategy11/formidable-pro#6929

Broken: Style > Field Colors > Error > Field Text didn't reach placeholder text in fields with an error, so placeholders stayed the disabled grey (unreadable on a dark Error background).

Changed: css/_single_theme.css.php adds an error-state placeholder rule (::placeholder, .frm_default, .placeholder) under .frm_blank_field and :invalid, using --text-color-error. A second rule restores the disabled colour for sub fields of a combo field that aren't themselves in error, matching the existing combo-field reset above it.

Verified: Live in a Playground instance on this branch's CSS. Error Background rgba(29,29,27,0.5), Error Field Text #fff, empty required text field with a placeholder, submitted empty. Computed ::placeholder colour: rgb(136,136,136) before, rgb(255,255,255) after.

Before After
before after

Not verified: combo-field sub-field reset rendered live (selector mirrors the existing reset); CI result.

🤖 Generated with Claude Code

Pre-PR WIP: live render check + PR still TODO.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@deepsource-io

deepsource-io Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in d31ea91...f71fb06 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Oct 30, 2026 12:24a.m. Review ↗
JavaScript Oct 30, 2026 12:24a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Comment thread css/_single_theme.css.php
border-style:var(--field-border-style)<?php echo esc_html( $important ); ?>;
}

.<?php echo esc_html( $style_class ); ?> .frm_blank_field input::placeholder,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $style_class might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

Comment thread css/_single_theme.css.php
}

.<?php echo esc_html( $style_class ); ?> .frm_blank_field input::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field textarea::placeholder,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $style_class might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

Comment thread css/_single_theme.css.php

.<?php echo esc_html( $style_class ); ?> .frm_blank_field input::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field textarea::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field input.frm_default,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $style_class might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

Comment thread css/_single_theme.css.php
.<?php echo esc_html( $style_class ); ?> .frm_blank_field input::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field textarea::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field input.frm_default,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field textarea.frm_default,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $style_class might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

Comment thread css/_single_theme.css.php
.<?php echo esc_html( $style_class ); ?> .frm_blank_field textarea::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field input.frm_default,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field textarea.frm_default,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .placeholder,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $style_class might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

Comment thread css/_single_theme.css.php
color:var(--text-color-error)<?php echo esc_html( $important ); ?>;
}

.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) input::placeholder,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $style_class might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

Comment thread css/_single_theme.css.php
}

.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) input::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) textarea::placeholder,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $style_class might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

Comment thread css/_single_theme.css.php

.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) input::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) textarea::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) input.frm_default,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $style_class might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

Comment thread css/_single_theme.css.php
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) input::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) textarea::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) input.frm_default,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) textarea.frm_default,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $style_class might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

Comment thread css/_single_theme.css.php
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) textarea::placeholder,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) input.frm_default,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) textarea.frm_default,
.<?php echo esc_html( $style_class ); ?> .frm_blank_field .frm_combo_inputs_container > .frm_form_field:not(.frm_blank_field) .placeholder {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable $style_class might not be defined


A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.

@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Oct 28, 2026

@franky-the-going-merry franky-the-going-merry 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.

Approving. Reproduced the bug live on base and confirmed the fix on this branch, using a Playground env with Lite at each commit and the stylesheet regenerated each time (the generated formidableforms.css is cached, so switching branches alone shows stale CSS).

Setup: default style with Error Field Text #fff and Error Background #1d1d1b, one required text field with placeholder "Your name here", submitted empty.

Computed ::placeholder colour Screenshot
Base (3a919a7) rgb(102, 112, 133) (disabled grey, hard to read on the dark error background) before
This PR (673bdf5) rgb(255, 255, 255) after

Checked by reading the CSS:

  • No regression before submit: on page load the required empty field is not :invalid and its placeholder stays disabled grey. The new :invalid selectors match the existing .frm_form_field :invalid error rule just above them, so the placeholder now follows the same state as the field's own error text, background and border.
  • Specificity: the new rule beats both existing placeholder rules (input::placeholder, input.frm_default) by at least one class, and the combo reset beats the new rule when a sub field is not itself in error.
  • Floating labels: custom_theme.css.php hides inside-label placeholders with opacity, not color, so this colour change doesn't surface them.
  • Same pattern elsewhere: no other error-state placeholder rules exist in css/ that this misses.

Not exercised live: the combo-field sub-field reset (Pro Name/Address). It mirrors the reset directly above it and I only verified its specificity from source. CI: Psalm and DeepSource PHP are red, but this diff is CSS-only inside a PHP template with no PHP logic changed. Reviewed by hand rather than with the review skills, given an 18-line CSS-only diff.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Oct 28, 2026
@Crabcyborg

Copy link
Copy Markdown
Contributor

Added a PHPUnit test, test_FrmStyle::test_generated_css_uses_error_color_for_placeholders_in_fields_with_errors (commit 625d1a6). It renders custom_theme.css.php through FrmStyle::get_css_content() and asserts that the .frm_blank_field and :invalid placeholder selectors use --text-color-error, and that the combo sub-field reset keeps --text-color-disabled. It fails against master CSS and passes on this branch.

Also merged master. test_FrmStyle passes (29 tests) and phpcs (Lite ruleset) is clean.

array( FrmAppHelper::plugin_path() . '/css/custom_theme.css.php' )
);

$this->assertMatchesRegularExpression( '/\.frm_blank_field input::placeholder,[^{]*\{color:var\(--text-color-error\)/', $css );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmStyle::assertMatchesRegularExpression()


The method you are trying to call is not defined, which can result in a fatal error.

);

$this->assertMatchesRegularExpression( '/\.frm_blank_field input::placeholder,[^{]*\{color:var\(--text-color-error\)/', $css );
$this->assertMatchesRegularExpression( '/\.frm_form_field input:invalid::placeholder,[^{]*\{color:var\(--text-color-error\)/', $css );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmStyle::assertMatchesRegularExpression()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertMatchesRegularExpression( '/\.frm_blank_field input::placeholder,[^{]*\{color:var\(--text-color-error\)/', $css );
$this->assertMatchesRegularExpression( '/\.frm_form_field input:invalid::placeholder,[^{]*\{color:var\(--text-color-error\)/', $css );
// Sub fields of a combo field without an error keep the normal placeholder color.
$this->assertMatchesRegularExpression( '/\.frm_form_field:not\(\.frm_blank_field\) input::placeholder,[^{]*\{color:var\(--text-color-disabled\)/', $css );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmStyle::assertMatchesRegularExpression()


The method you are trying to call is not defined, which can result in a fatal error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant