Skip to content

Forms: Custom placeholder text color is overridden on the frontend #41417

Closed
@aaronrobertshaw

Description

@aaronrobertshaw

Impacted plugin

Jetpack

Quick summary

Setting a custom placeholder text color on form fields only works in the editor.

Editor Frontend
Image Image

Note: The field width, gap spacing etc should be fixed by #41415 and was reported in #41414

It appears that these styles blindly enforce color ::placeholder pseudo elements.

Steps to reproduce

  1. Add a contact form to a post
  2. Select a field and set a custom field text color
  3. Save post and view on the frontend. Note the color is different to the editor

Site owner impact

Fewer than 20% of the total website/platform users

Severity

Minor

What other impact(s) does this issue have?

No response

If a workaround is available, please outline it here.

No response

Platform (Simple and/or Atomic)

No response

Activity

added
[Block] Contact FormForm block (also see Contact Form label)
[Feature] Forms BlocksBlocks designed to streamline user input and engagement, such as contact, newsletter sign-ups, etc.
[Type] BugWhen a feature is broken and / or not performing as intended
Needs triageTicket needs to be triaged
on Jan 30, 2025
aaronrobertshaw

aaronrobertshaw commented on Jan 30, 2025

@aaronrobertshaw
ContributorAuthor

This might be resolved down the line if we switch to inner blocks for form fields (see #41281).

In the short term though, we could tweak the styles to take into account the fact the custom color is applied on the field wrapper as a custom CSS property e.g. --jetpack--contact-form--text-color.

I don't think we can rely on input[type="..."]:not([style*="color"]) because it would erroneously exclude inputs with just background-color or border-color set.

aaronrobertshaw

aaronrobertshaw commented on Mar 6, 2025

@aaronrobertshaw
ContributorAuthor

It looks like the situation flagged by this issue changed with #41712.

After that PR merged, the field's input now uses an actual placeholder unless the field block is currently selected. This results in the placeholder using placeholder styles not the field's text color which in turn makes the placeholders consistently styled between the editor and frontend.

I'll close this issue as completed by #41712.

Editor Frontend
Image Image

Note in the above editor screenshot the name field is selected thus showing the field text color. The name and email fields share synced styles so the email field demonstrates the new styling/use of placeholders in the editor.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    • Status

      Done 🎉

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

      Participants

      @jeherve@matticbot@aaronrobertshaw

      Issue actions

        Forms: Custom placeholder text color is overridden on the frontend · Issue #41417 · Automattic/jetpack