Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forms: Only load the styles that are revelant for the specific form #41521

Open
enejb opened this issue Feb 3, 2025 · 3 comments
Open

Forms: Only load the styles that are revelant for the specific form #41521

enejb opened this issue Feb 3, 2025 · 3 comments
Labels
[Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Focus] Performance [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal Triaged [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Comments

@enejb
Copy link
Member

enejb commented Feb 3, 2025

Impacted plugin

Jetpack

Quick summary

Currently when a user add the Jetpack form on to the page we also load grunion css file.
Which is about 20kb of css and contains the css for all the different "styles" of forms.

This should be reduced in such a way so that we only load the necessary styles.
A good first step would be to only include 1 style per css file.

Steps to reproduce

Load a jetpack form on the frontend.
Notice the large css file.

Site owner impact

Fewer than 20% of the total website/platform users

Severity

Minor

What other impact(s) does this issue have?

No revenue impact

If a workaround is available, please outline it here.

No response

Platform (Simple and/or Atomic)

Simple, Atomic, Self-hosted

@enejb enejb added [Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it Needs triage Ticket needs to be triaged labels Feb 3, 2025
Copy link
Contributor

github-actions bot commented Feb 3, 2025

This issue could use some more labels, to help prioritize and categorize our work. Could you please add at least a [Type], a [Feature], and a [Pri] label?

@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Feb 3, 2025
@jeherve jeherve added [Focus] Performance Triaged [Pri] Normal and removed Needs triage Ticket needs to be triaged labels Feb 4, 2025
@simison
Copy link
Member

simison commented Feb 4, 2025

I think that once many of the styles are in Global styles, the system will take care of this automatically; only global styles for inputs that are present are included. Not sure if that same mechanism applies to style variations, though. cc @aaronrobertshaw @talldan

@aaronrobertshaw
Copy link
Contributor

I think that once many of the styles are in Global styles, the system will take care of this automatically; only global styles for inputs that are present are included

Global Styles, by default, will only output styles for blocks that are on the page. So if we move to inner blocks for forms, the global styles for those would appear whenever they are on the page. The other styles, e.g. custom date picker or select etc., will still need to be loaded somehow.

Not sure if that same mechanism applies to style variations, though. cc

Block style variations have styles generated for each application. This was to support nesting different variations and enhanced "section-based" styling. If a block style variation isn't on the page, no block style variation styles are generated.

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 [Focus] Performance [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal Triaged [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

No branches or pull requests

4 participants