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

Map block: Allow block selection when Mapkit is being used #38956

Merged
merged 9 commits into from
Aug 28, 2024

Conversation

coder-karen
Copy link
Contributor

@coder-karen coder-karen commented Aug 19, 2024

Fixes #31870

Proposed changes:

  • This PR adds an overlay div to the Mapkit map markup that is rendered, in order to allow the block to be selectable.
  • This fixes an issue where it isn't possible to use a mouse to select the block just by clicking on the block, within the wp-admin post / page editor.

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

#31870

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

No.

Testing instructions:

On self-hosted:

  • Though this isn't an issue for self-hosted sites as they use Mapbox for the maps used in the Map block, you can still replicate the issue and test the fix there.
  • When adding a Map block to a post or page, add the following via the developer console: document.cookie = "map_provider=mapkit";. You should then be able to add a map using Mapkit. Make sure the map style is not 'Terrain' as that uses Mapbox.
  • On trunk, notice that you cannot use your mouse to select the block (the map block settings are not visible in the sidebar, you can only move the map).
  • With this PR applied, you will be able to see the map settings in the sidebar. With an extra mouse click, you can also move around the map as before.

On WoA / Simple:

  • Add a Map block to a post or page in wp-admin, not WordPress.com (eg. /wp-admin/post.php?post={postnumber}&action=edit)., and without the PR applied you should be able to replicate the issue as above. Make sure the map style is not 'Terrain' as that uses Mapbox.
  • On WoA apply the PR via the beta tester plugin, and on Simple you can use the command in the generated comment below to apply the changes to a sandboxed site.
  • You should now be able to select the Map block itself and see the map settings, just by clicking on the map. An additional click should allow you to move around the map.

Copy link
Contributor

github-actions bot commented Aug 19, 2024

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 fix/map-block-selection branch.

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

    bin/jetpack-downloader test jetpack fix/map-block-selection
    

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 the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Aug 19, 2024
Copy link
Contributor

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.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? 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 daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for September 3, 2024 (scheduled code freeze on September 2, 2024).

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

@coder-karen coder-karen added this to the jetpack/13.8 milestone Aug 19, 2024
@coder-karen coder-karen marked this pull request as ready for review August 21, 2024 15:06
@@ -80,11 +106,25 @@ const MapkitComponent = forwardRef(
onMapLoaded={ onMapLoaded }
/>
) : null }

{ /* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */ }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noting that I'm just focussed on mouse click events - this PR doesn't introduce other accessibility issues but I did notice existing ones that should get fixed later: #38986

@coder-karen coder-karen requested a review from a team August 21, 2024 16:08
@coder-karen coder-karen added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Status] Needs Team Review and removed [Status] In Progress [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Aug 21, 2024
Copy link
Contributor

@darssen darssen left a comment

Choose a reason for hiding this comment

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

Although I am not able to replicate the issue, this doesn't seem to introduce any problems either.
@jp-imagines can you test and check if this solves the issue for you?

@jp-imagines
Copy link

@darssen I was able to replicate the original issue on a test site again, and applying this PR did fix it – I can select the Map block again and interact with it on a second click.

Copy link
Contributor

@darssen darssen left a comment

Choose a reason for hiding this comment

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

Great!
🚢

Copy link
Contributor

@sergeymitr sergeymitr left a comment

Choose a reason for hiding this comment

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

I was only able to reproduce the issue on a self-hosted site using document.cookie = "map_provider=mapkit";, but can confirm that the PR solved the problem.
Great job 👍

@sergeymitr sergeymitr added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Team Review labels Aug 28, 2024
@coder-karen coder-karen merged commit e7eadc0 into trunk Aug 28, 2024
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Map [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.

Map block: Selecting the Map block in the editor is very difficult
4 participants