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

Fixes removal of unstableOnFocus prop #20484

Conversation

mhkuu
Copy link
Contributor

@mhkuu mhkuu commented Jul 7, 2023

Context

  • In Gutenberg 15.2, in this PR, the prop unstableOnFocus was removed. As the Gutenberg version for WordPress 6.3 will be upgraded to 16.1, in the current PR, we prepare ourselves for the WP 6.3 release by addressing this issue.
  • By using both the unstableOnFocus and the onFocus prop, we will continue to support Gutenberg versions below 15.2 (and consequently, WordPress version below 6.3).

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where the controls for the FAQ and how-to blocks would be not shown when running Gutenberg versions >= 15.2.

Relevant technical choices:

  • By using both the unstableOnFocus and the onFocus prop, we will continue to support Gutenberg versions below 15.2 (and consequently, WordPress version below 6.3). We might decide to remove unstableOnFocus at some future point in time, though, but we should be wary to do that once we no longer support WP 6.2.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

WP 6.3

  • Install WordPress Beta Tester plugin.
  • Install WP 6.3-beta3 (Tools -> Beta Testing, select Bleeding Edge and Beta/RC only, then go to wp-admin/update-core.php to install that version).
  • Create new post.
  • Add a FAQ block.
  • Make sure that every FAQ question/answer you focus on, renders the controls for that question/answer (and removes the controls for other question/answer pairs).
  • Now, add a How-To block.
  • Similarly, make sure that every How-To step title/description you focus on, renders the controls for that step (and removes the controls for other steps).
  • Note that the overall description of the How-To block should remove the controls for all steps.

WP 6.2

  • Re-install WP 6.2.2 at wp-admin/update-core.php.
  • Confirm that the above steps work.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Block/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • The FAQ and How-To structured data blocks.

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes https://github.com/Yoast/plugins-automated-testing/issues/843

@mhkuu mhkuu added the changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog label Jul 7, 2023
@mhkuu mhkuu changed the base branch from trunk to feature/lingo-fixes July 7, 2023 09:20
@mhkuu mhkuu changed the base branch from feature/lingo-fixes to trunk July 7, 2023 09:22
@mhkuu mhkuu marked this pull request as ready for review July 7, 2023 09:26
@mhkuu mhkuu changed the base branch from trunk to feature/lingo-fixes July 7, 2023 10:26
@@ -332,6 +332,9 @@ export default class Question extends Component {
answer,
} = attributes;

// The unstableOnFocus prop is added for backwards compatibility with Gutenberg versions <= 15.1 (WordPress 6.2).
const focusQuestion = { onFocus: this.onFocusQuestion, unstableOnFocus: this.onFocusQuestion };
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to extract properties into variables and use destruction instead of just put them inside elements ?
Variables are not used in any other place and I guess this solution is more complex than just put them inline.

This question applied to all lines below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I agree and made the change 👍 The reason I did it like this was to not have to repeat the same comment. But as it adds more complexity we can indeed just add the props.

Base automatically changed from feature/lingo-fixes to trunk July 10, 2023 13:17
@mhkuu mhkuu changed the base branch from trunk to feature/lingo-fixes July 10, 2023 13:18
@mykola mykola merged commit 037a100 into feature/lingo-fixes Jul 10, 2023
@mykola mykola deleted the 843-wp-63-controls-are-not-displayed-in-yoast-blocks branch July 10, 2023 14:39
@mhkuu mhkuu mentioned this pull request Jul 11, 2023
18 tasks
@mhkuu mhkuu added this to the 20.12 milestone Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants