Skip to content

UI library: Modal.CloseButton should not require the onClick prop#22025

Merged
vraja-pro merged 1 commit intotrunkfrom
fix-ui-lib-modal-close-button-prop
Feb 11, 2025
Merged

UI library: Modal.CloseButton should not require the onClick prop#22025
vraja-pro merged 1 commit intotrunkfrom
fix-ui-lib-modal-close-button-prop

Conversation

@igorschoester
Copy link
Copy Markdown
Contributor

Context

  • Fixes a required prop mistake made in this PR.

Summary

This PR can be summarized in the following changelog entry:

  • [@yoast/ui-library 0.0.1] Fixes an unreleased bug where the Modal.CloseButton would have the onClick prop marked as required, while it would fall back to the Modal's onClose if not provided.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

Devs: JS tests

  • Run the tests for JS, specifically the unsaved changes modal test was how I noticed this React prop warning
  • Without this PR you get the prop warning:

Warning: Failed prop type: The prop onClick is marked as required in Modal.CloseButton, but its value is undefined

  • With this PR you should no longer get that warning

In the plugin

  • Enable script debug so you get React warnings in the console
  • Go to settings
  • Change a value
  • Click on discard changes
  • Without this PR you get the prop warning:

Warning: Failed prop type: The prop onClick is marked as required in Modal.CloseButton, but its value is undefined

  • With this PR you should no longer get that warning
  • Regression: verify that clicking the Close button (X icon in top right) closes the modal

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 (Default Block/Gutenberg/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:

  • This concerns a React prop warning that should not affect functionality. If you want, you can enable script debugging and check out the plugin settings test instructions.

Impact check

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

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. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

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 #

It is falling back on the onClose from the modal context!
@igorschoester igorschoester added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Feb 10, 2025
@igorschoester igorschoester requested a review from a team as a code owner February 10, 2025 09:48
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build c3643177360861c963f5a41caa9c2d5b5d3042ab

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 54.581%

Totals Coverage Status
Change from base Build 2d39f817ad47444fce9230e581a5710e9e3958b5: 0.0%
Covered Lines: 30316
Relevant Lines: 55967

💛 - Coveralls

@vraja-pro vraja-pro self-assigned this Feb 11, 2025
@vraja-pro
Copy link
Copy Markdown
Contributor

CR & AC ✅

@vraja-pro vraja-pro added this to the 24.6 milestone Feb 11, 2025
@vraja-pro vraja-pro merged commit e235679 into trunk Feb 11, 2025
@vraja-pro vraja-pro deleted the fix-ui-lib-modal-close-button-prop branch February 11, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants