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: Add Feedback link to admin bar #42474

Merged
merged 8 commits into from
Mar 18, 2025
Merged

Conversation

enejb
Copy link
Member

@enejb enejb commented Mar 14, 2025

This PR adds a quick link to the admin bar if the user is visiting a single page or post on the frontend and is someone that should have access to the dashboard.

It only shows up if we are also going to render the form.

On single page with a form on.

Screenshot 2025-03-14 at 10 35 23 AM

On a single page without a form.

Screenshot 2025-03-14 at 10 35 17 AM

To disable the newly added quick_link menu you can
do the following:

function my_plugin_prefix_disable_jetpack_contact_admin_bar( $html ) {
	remove_action( 'admin_bar_menu', array( 'Automattic\Jetpack\Forms\ContactForm\Contact_Form', 'add_quick_link_to_admin_bar' ), 500 );
	return $html;
}
add_filter( 'jetpack_contact_form_html', 'my_plugin_prefix_disable_jetpack_contact_admin_bar' );

Proposed changes:

  • Adds the Feedback quick link to the admin bar.

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?

No

Testing instructions:

  • As a logged in editor or admin user visit a single page or post that has a form on. Notice that you see the feeedback link in the Admin bar.
  • As a visitor notice that you don't see it.
  • Pages without a form shouldn't display the feedback link. The link should take you to your preferred feedback view ( classic or modern)

@enejb enejb added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Team Review Obsolete. Use Needs Review instead. [Package] Forms labels Mar 14, 2025
@enejb enejb requested a review from a team March 14, 2025 17:50
@enejb enejb self-assigned this Mar 14, 2025
Copy link
Contributor

github-actions bot commented Mar 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 add/form-responses-to-admin-bar branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/form-responses-to-admin-bar

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

@github-actions github-actions bot added [Feature] Contact Form [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Mar 14, 2025
Copy link
Contributor

github-actions bot commented Mar 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!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: April 1, 2025
    • Code freeze: March 30, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@enejb enejb changed the title Add/form responses to admin bar Forms: Add Feedback link to admin bar Mar 14, 2025
@ilonagl
Copy link

ilonagl commented Mar 14, 2025

Hey @enejb 👋,

This is a great and quick solution! 🙌

I wonder about the naming and whether it's clear enough, maybe something like 'Form Feedback' (adding Form) could help to clarify what this is (especially for new users)? It takes a bit more space tho.

Copy link

jp-launch-control bot commented Mar 14, 2025

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/contact-form/class-contact-form.php 539/788 (68.40%) -1.24% 14 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@simison
Copy link
Member

simison commented Mar 14, 2025

@crisbusquets @Copons any needs to coordinate this with anyone from Dotcom? Note that this Only applies to pages with forms on them.

@enejb what happens if form is in footer/sidebar? It would be too much to render on every page.

@ilonagl thoughts on what the link copy should be?

@simison
Copy link
Member

simison commented Mar 14, 2025

@enejb how's the mobile version?

@enejb
Copy link
Member Author

enejb commented Mar 14, 2025

@simison

what happens if form is in footer/sidebar? It would be too much to render on every page.

If we are a single (page or post or any other post type) - we would show the link to the form responses. Even if it is a shortcode or a widget.

In the current version we only link users to the default form responses page. No source attribute. But ideally we would send the user to the correct one.

how's the mobile version?

The mobile version doesn't show the link at all.

See

Screenshot 2025-03-14 at 12 12 46 PM

@crisbusquets
Copy link
Contributor

Oh, hello Zap! ⚡

From what I understand, we want to give site admins a quick link to check replies for a specific form, right?

Not sure how feasible that would be, but could we explore rendering the block differently so the link appears with the form? The Feedback link in its current spot seems easy to miss 🤔

@simison
Copy link
Member

simison commented Mar 14, 2025

Admin area felt more fitting semantically since that's where other admin stuff goes: also where you edit current page, or check stats for the current post.

Also nice not to keep the page as WYSIWYG as possible with editor and no extra things appearing, potentially messing up with page layout.

Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

This is testing as advertised for me 👍

✅ Form responses link shows on individual posts and pages
✅ New link isn't displayed on index pages or mobile

I have a few minor questions and thoughts I've left as inline comments.

Screenshot_17-Mar_14-23-53_25043

Edit: Looking at this screenshot again, the lack of an icon for "Form responses" stuck out. Are there plans for a follow-up addressing this?

@ilonagl
Copy link

ilonagl commented Mar 17, 2025

@ilonagl thoughts on what the link copy should be?

Form responses that is currently used is the most straightforward one, and keeps things consistent with our namings (img reference below). This reduces guesswork and makes label recognition easier for users.

I agree with @aaronrobertshaw that having an icon would help keep the links consistent with the rest. Can we reuse the existing Feedback icon from the sidebar? It’s not ideal, but it maintains consistency for now, and we can update both instances when we have a better one.

Screenshot 2025-03-17 at 18 32 32

@enejb
Copy link
Member Author

enejb commented Mar 17, 2025

The updates admin bar with the icon.

Screenshot 2025-03-17 at 12 23 53 PM

Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

This is getting closer, thanks for the iterations here @enejb 👍

I think we can clean up some of the icon styles, then it should be ready to go.

I've tested the current PR state along with my suggested tweak below and visually they are the same.

Screenshot_18-Mar_12-10-48_28662

@enejb enejb merged commit 959e9e5 into trunk Mar 18, 2025
63 of 64 checks passed
@enejb enejb deleted the add/form-responses-to-admin-bar branch March 18, 2025 17:19
@github-actions github-actions bot added this to the jetpack/14.5 milestone Mar 18, 2025
@github-actions github-actions bot removed the [Status] Needs Team Review Obsolete. Use Needs Review instead. label Mar 18, 2025
@crisbusquets
Copy link
Contributor

Sorry I'm late. Did you implement tracking here? This way we'll be able to know how many people click that option 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Contact Form [Package] Forms [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [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.

5 participants