Repository navigation
Forms: Rating block - #44094
Forms: Rating block#44094
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 4 files.
7 files are newly checked for coverage. Only the first 5 are listed here.
Full summary · PHP report · JS report Coverage check overridden by
I don't care about code coverage for this PR
|
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces a new "Rating" field block for Jetpack Forms, allowing site owners to collect ratings via stars, hearts, smiley, or emoji icons.
- Added rating field registration and associated render callbacks in PHP.
- Implemented front-end assets including JavaScript interactivity, SCSS styles, icons, and block editor components.
- Updated webpack config, block options, and child block registration to include the new rating field.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| projects/packages/forms/tools/webpack.config.blocks.js | Updated to enqueue styling for the new rating field. |
| projects/packages/forms/src/modules/field-rating/view.js | Imports interactivity for the rating field. |
| projects/packages/forms/src/contact-form/class-contact-form-plugin.php | Added callback to render the rating field. |
| projects/packages/forms/src/contact-form/class-contact-form-field.php | Extended field rendering to include a new case for rating fields with supporting functions. |
| projects/packages/forms/src/blocks/options/index.js | Included the rating field in the parent block list. |
| projects/packages/forms/src/blocks/field-rating/* | Added full block implementation (edit, save, interactivity, icons, style) for the rating field. |
| projects/packages/forms/src/blocks/contact-form/class-contact-form-block.php & child-blocks.js | Registered the new rating field block and updated child blocks accordingly. |
| projects/packages/forms/changelog/add-rating-field | Added changelog entry for the new field. |
fa3fc7d to
08f6a34
Compare
be24efa to
20cf614
Compare
504bb0a to
ab1e833
Compare
|
cc @ederrengifo |
There was a problem hiding this comment.
I think this stars.js file is only imported in the input-rating/edit.js block? If so, should we move this file to that folder instead?
There was a problem hiding this comment.
I'm wondering a bit about this approach to loading our stars. It seems like an unusual approach, and requires a network request. I think there are also GDPR considerations (Do google fonts violate GDPR?) Not sure what the best alternative is - possibly using svgs? But that may change the architecture of the block markup and behavior.
There was a problem hiding this comment.
Good question! I'm completely unaware of GDPR issues with Google Fonts, but shouldn't that fall on their lap? This can't be the only place we use Gfonts
There was a problem hiding this comment.
Not a big deal, but for all other lines where we invoke render_rating_field(), all the arguments are included in a single line.
There was a problem hiding this comment.
Single liners are prone to hide issues due to overflowing the IDE. While our codebase is filled with these type of aberrations, the new linters automatically parse calls into multiple lines when the line length is exceeded. We didn't do this, it was done by the linter and I'd just let that take over little by little :)
There was a problem hiding this comment.
There's a lot of complex css logic here, and it seems like it could be brittle. I'm having a hard time following it, and it may be needed, but just seems un-ideal.
There was a problem hiding this comment.
Some comments there could help, but agree it's not the best
Introduces a new 'Rating (stars)' field block for forms, allowing visitors to select a rating.
…pport from field to input
…les matching border/stroke on stars
…s (replaces commas with htmlentity)
…nt PHP warning on undefined item member
…, print inherited classes from the process
092df41 to
ede1c8c
Compare


This pull request introduces a new "Rating" field block for Jetpack Forms, allowing site owners to collect ratings via stars, hearts, smiley, or emoji icons.
Added rating field registration and associated render callbacks in PHP.
Implemented front-end assets including JavaScript interactivity, SCSS styles, icons, and block editor components.
Updated webpack config, block options, and child block registration to include the new rating field.
Fixes #40890
Design: p1HpG7-wTL-p2
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: