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

Enhance sharing buttons UI #34181

Merged
merged 18 commits into from
Nov 28, 2023
Merged

Enhance sharing buttons UI #34181

merged 18 commits into from
Nov 28, 2023

Conversation

andrii-lysenko
Copy link
Contributor

@andrii-lysenko andrii-lysenko commented Nov 17, 2023

Fixes #34116 and #34108

Proposed changes:

After discussion in a primary ticket we are moving forward with the implementation similar to Social Links in Gutenberg.
This PR adds new Sharing Button block alongside Sharing Buttons one that is used as a container. Also, added styles to match existing behaviour.

Note: Official buttons style is not yet available and we will add it on later stages. This is also still a dummy block with no logic connected and probably some code to be improved in the future.

Screen.Recording.2023-11-22.at.12.15.30.mov

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)?

Testing instructions:

  • Spin up your site with local changes
  • Make sure you have beta block enabled. In your environment (example Docker) wp-config.php you should have define( 'JETPACK_BLOCKS_VARIATION', 'beta' );
  • Add Sharing Buttons block to a post and check it's behaviour.

@github-actions github-actions bot added [Block] Sharing Buttons [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Block] Sharing Button labels Nov 17, 2023
Copy link
Contributor

github-actions bot commented Nov 17, 2023

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 Team Review, ...).
  • ✅ 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 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


🔴 Action required: We would recommend that you add a section to the PR description to specify whether this PR includes any changes to data or privacy, like so:

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

My PR adds *x* and *y*.

Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

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

  • WordPress.com Simple releases happen daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for December 5, 2023 (scheduled code freeze on November 28, 2023).

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

Copy link
Contributor

github-actions bot commented Nov 18, 2023

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 WordPress.com Simple 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, and enable the update/sharing-block-ui branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack update/sharing-block-ui
    

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

@andrii-lysenko andrii-lysenko requested a review from a team November 22, 2023 21:27
@andrii-lysenko andrii-lysenko marked this pull request as ready for review November 22, 2023 21:28
@andrii-lysenko andrii-lysenko changed the title first draft to enhance sharing buttons UI Enhance sharing buttons UI Nov 23, 2023
$data_shared = 'sharing-' . $attr['service'] . '-' . $post_id . $attr['service'];
$link_url = get_permalink( $post_id ) . '?share=' . $attr['service'] . '&nb=1';

$content = str_replace( 'url_replaced_in_runtime', $link_url, $content );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is a temporary solution while block is still in beta.

Copy link
Contributor

@monsieur-z monsieur-z left a comment

Choose a reason for hiding this comment

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

I noticed a couple of rough edges in the UI. The PR still has the In Progress label, so don't mind me if these are already known.

  1. It'd be nice to have a preview of the block (definitely something that could be done later).
Screenshot 2023-11-24 at 8 59 14 AM
  1. The label could be a bit clearer, e.g., Click the plus icon to add a social network.
Screenshot 2023-11-24 at 8 59 36 AM
  1. The button style can be chosen in both the block's Settings and Styles panels. Should we leave the selection in Styles only?
Screenshot 2023-11-24 at 9 00 45 AM Screenshot 2023-11-24 at 9 00 48 AM
  1. The rendering seems to be the same in the front-end, no matter the style.

  2. When adding a button, the Sharing button is proposed but has no icon? Should it even be there?

Screenshot 2023-11-24 at 9 01 34 AM
  1. The button labels are rendered in lowercase and with no start padding in the front-end.
Screenshot 2023-11-24 at 9 02 26 AM
  1. Is this block independent from the Sharing buttons settings?
Screenshot 2023-11-24 at 9 07 57 AM

@andrii-lysenko
Copy link
Contributor Author

@monsieur-z Thank you for a thorough review. Initially I also thought that we will want to wrap up the UX with this task, however, after discussion with Design, we enhanced a different approach here. So I wanted to roll out initial step, where we basically change the behavior from single block to parent-child. We would still need to do a fare amount of work with UI, including Ofiicial buttons, More button and some adjustmentes to the logic inside as well. So to keep things going, thought we could merge this as a step, but definitely not the final look. What do you think?

@andrii-lysenko
Copy link
Contributor Author

Though, most of them are pretty easy to fix, so I pushed it. As per the last point, yes, these two functionalities are currently disconnected and probably be like that till the very last step, not to provide issues to the users, while we are still working on the block.


registerJetpackBlockFromMetadata( metadata, {
edit,
save,
example: {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the example could be added to block.json instead, since it doesn't have dynamic values.


const ViewSocialButton = ( { service, url } ) => {
return (
<a
Copy link
Contributor

Choose a reason for hiding this comment

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

From an accessibility perspective, we could make screen readers read something like Share to Facebook rather than Facebook. This would provide more context to screen reader users and avoid confusion if there are multiple link labelled Facebook on the page.

We could do that by adding an aria-label attribute on the a and, I believe, hiding the span with aria-hidden="true".

}

.jetpack-sharing-button__service-label {
margin-left: 5px;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably safer to use margin-inline-start for internationalization reasons.

monsieur-z
monsieur-z previously approved these changes Nov 27, 2023
Copy link
Contributor

@monsieur-z monsieur-z left a comment

Choose a reason for hiding this comment

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

Thanks for the additional context @andrii-lysenko. I left some comments but they can definitely be tackled later one.

@andrii-lysenko
Copy link
Contributor Author

@monsieur-z Thanks for highlighting these. I think it is worth having these added so I pushed an additional commit.

@chrisbliss18 chrisbliss18 self-requested a review November 27, 2023 23:48
Copy link
Contributor

@chrisbliss18 chrisbliss18 left a comment

Choose a reason for hiding this comment

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

I see that you made the changes that @monsieur-z requested. Everything looks good. Approved!

@andrii-lysenko andrii-lysenko merged commit 17dc392 into trunk Nov 28, 2023
51 checks passed
@andrii-lysenko andrii-lysenko deleted the update/sharing-block-ui branch November 28, 2023 00:41
@github-actions github-actions bot added this to the jetpack/12.9 milestone Nov 28, 2023
@keoshi
Copy link
Contributor

keoshi commented Nov 28, 2023

Commenting here after the PR merge but hope this feedback is useful. Love the suggestions that @monsieur-z left above, btw!

1. Adding the block the first time asked me to activate the sharing feature. This is great, but it also added the old sharing buttons by default. Disregard this one, I was testing RC and not Bleeding Edge.

  1. Agree with @monsieur-z that the placeholder copy could be Click the plus icon to add a social network.
image
  1. The empty + unselected state is perfectly fine, but I wonder if we should try to do something like the social icons do. E.g.: add a visual flare to denote the block hasn't been touched yet.
image
  1. The block options — moving icons, justification, alignment, orientation, styles — worked perfectly. Very neat that people will soon have much more flexibility to play around with these buttons.
image
  1. The child blocks description is the same across the board but refers to the parent block. Perhaps we should replicate what the Social block is doing.
  • Suggested copy: Display a button that allows people to share your content to a social media network.
image

image

  1. We could probably approximate the style of the new buttons with the older ones, so that nothing really changes in their site design. In particular icon size and font size.
image
  1. "Official Buttons" didn't work for me; it shows the same styling as Icon & Text, but I'm guessing this hasn't been built out yet.
image
  1. Finally, a sidenote: I'm seeing BETA tags in the child blocks as well. Would be great to get rid of these and just have one in the parent block so the editing interface shines through while we test the UI.
image

This is looking very, very promising @andrii-lysenko — awesome work so far! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Sharing Button [Block] Sharing Buttons [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sharing block: enhance block view
4 participants