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

Resolve console error when using "Sort by" or "Order by" on Patterns page #68565

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

devansh016
Copy link
Contributor

What?

This PR resolves a console error that occurs when interacting with the "Sort by" or "Order by" dropdowns on the Patterns page. A null check for contentDocument has been added to ensure iframe initialization happens only after the iframe content is fully loaded.

Why?

The error prevents the proper functioning of the Patterns page, impacting the user experience. This issue was reproducible across multiple themes and environments, as detailed in the related issue.

Related Issue: #68562

How?

The fix introduces a null check for contentDocument in the iframe initialization logic. This ensures that operations on the iframe are only executed when its content is available, preventing the TypeError that previously occurred.

Introduced in #38855 ( since we no longer try to initialise the iframe before the load event) another reference #51003

Testing Instructions

  1. Go to the Patterns page in the WordPress admin.
  2. Interact with the "Sort by" or "Order by" dropdown to change the sorting order.
  3. Verify that no errors appear in the browser console.
  4. Confirm that the dropdown functionality works as expected.

Screenshots or screencast

Screenshot 2025-01-09 at 5 41 31 PM

…erns page by adding a null check for contentDocument.
@devansh016 devansh016 requested a review from ellatrix as a code owner January 9, 2025 12:18
Copy link

github-actions bot commented Jan 9, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: devansh016 <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano linked an issue Jan 11, 2025 that may be closed by this pull request
6 tasks
@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Package] Block editor /packages/block-editor labels Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Console error when using "Sort by" or "Order by" on the Patterns page
2 participants