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

Prevent clicking Related Post links in the editor. #2998

Merged
merged 6 commits into from
Sep 22, 2022
Merged

Conversation

JakePT
Copy link
Contributor

@JakePT JakePT commented Sep 13, 2022

Description of the Change

Prevents clicking on links in the Related Posts block in the editor.

Originally I had planned on mimicking the behaviour of the core Latest Posts block, and the code is based on that implementation, which displays a notice when attempting to click a link. However, on investigating more core blocks this behaviour is unique to the Latest Posts block and all other blocks, such as the various query loop blocks like the linked post title or date, simply silently preventDefault on any links. To avoid the overhead of needing to manage a notice I've gone with the more common convention.

This PR also converts the Related Posts block's edit component to a functional component.

Closes #2967

How to test the Change

  1. Add a Related Posts block to the editor.
  2. Attempt to follow the link for one of the results.
  3. The link should not be followed.

Changelog Entry

Fixed - Clicking a Related Posts link while in the editor will no longer follow the link.

Credits

Props @JakePT

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@JakePT JakePT added this to the 4.4.0 milestone Sep 13, 2022
@JakePT JakePT marked this pull request as ready for review September 16, 2022 15:06
@JakePT JakePT self-assigned this Sep 16, 2022
@felipeelia felipeelia modified the milestones: 4.4.0, 4.3.1 Sep 19, 2022
@felipeelia felipeelia merged commit f837a51 into develop Sep 22, 2022
@felipeelia felipeelia deleted the fix/2967 branch September 22, 2022 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Related Posts links are clickable in the editor
2 participants