Skip to content

Conversation

MaggieCabrera
Copy link
Contributor

@MaggieCabrera MaggieCabrera commented Aug 14, 2025

The frontend has a 0,0,0 specificity for the CSS that can be changed by the user, whereas the editor has a 0,1,0. This is not a problem today, but it will be an issue when WordPress/gutenberg#70378 gets merged. The GB PR aims to add the ability to style inputs via the elements API with theme.json. It works out of the box for Jetpack with the current styles but only in the frontend, the editor is still too specific. This PR aligns the two so it will work when the GB changes land.

Frontend:

Screenshot 2025-08-18 at 12 37 48

Editor:

Screenshot 2025-08-18 at 12 38 30

Proposed changes:

Maintained the same selectors but moved the :where() to encase all of it instead of partially to fit the specificity requirement

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Insert a contact form, inspect the styles for inputs in the editor and frontend. The specificity should be the same
  • Check that custom user styles still apply correctly.

If possible, test with the GB PR active too:

  • Change your theme.json to have changes such as
"elements": {
			"textInput": {
				"border": {
					"radius": "0",
					"style": "solid",
					"width": "1px",
					"color": "red"
				},
				"color": {
					"text": "blue"
				},
				"typography": {
					"fontFamily": "var(--wp--preset--font-family--inter)"
				}
			},
}
  • The input's border should have changed to be red both in the frontend and the editor (prior to this PR the editor would not reflect the changes)

Copy link
Contributor

github-actions bot commented Aug 14, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the try-form-specificity branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack try-form-specificity

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

Copy link
Contributor

github-actions bot commented Aug 14, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Aug 14, 2025
@MaggieCabrera MaggieCabrera added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Aug 14, 2025
Copy link

jp-launch-control bot commented Aug 14, 2025

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@simison
Copy link
Member

simison commented Aug 15, 2025

Please feel free to ask reviews from Zap team (and "jetpack-forms" on Slack) when you want more eyes on this. Zenith team might also be interested to take a look as they recently solved too high specificity issues in Forms. Thanks!

@MaggieCabrera MaggieCabrera changed the title Try form specificity Contact form: lower specificity in the editor to match the frontend Aug 18, 2025
@MaggieCabrera MaggieCabrera marked this pull request as ready for review August 18, 2025 10:45
@MaggieCabrera MaggieCabrera requested a review from a team August 18, 2025 10:46
Comment on lines +735 to +737
&::placeholder {
opacity: 0.5;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This also aligns with the frontend styles. I couldn't see a reason why it had to be styled differently

Copy link
Member

@enejb enejb left a comment

Choose a reason for hiding this comment

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

In my testing it worked well.

I noticed some discrepancies between textarea and the regular text input.

between the editor and the frontend view. But they are there in trunk already.

From my testing this change seems safe to make.

@MaggieCabrera MaggieCabrera merged commit d8ab32a into trunk Aug 25, 2025
68 of 69 checks passed
@MaggieCabrera MaggieCabrera deleted the try-form-specificity branch August 25, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Package] Forms [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants