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

Plugin: Navigation menu doesn't appear when hamburger clicked on #45773

Merged
merged 1 commit into from
Nov 16, 2022

Conversation

t-hamano
Copy link
Contributor

@t-hamano t-hamano commented Nov 15, 2022

Fixed reopened #33273

What?

This PR fixes a problem with the Gutenberg plugin enabled in a Windows environment where the modal doesn't appear when the navigation hamburger is clicked.

Why?

This problem is caused by /lib/compat/wordpress-6.1/blocks.php for backward compatibility.

My understanding is that the gutenberg_block_type_metadata_view_script function exists to load multiple viewScripts in the old WordPress version. And in the navigation block, view.min.js and view-modal.min.js, are specified as viewScripts.

In this function, the forward slash and backslash are mixed as path delimiters, which causes the problem that view-modal.min.js in the above script is not loaded.

@bobbingwide's analysis of this issue in this comment may also be helpful.

How?

Within this function, all path delimiters have been unified into forward slashes.
I will explain the details in turn in the comments that follow.

Testing Instructions

  • Fork this PR into the plugin directory of your local Windows environment and build it.
  • Confirm that both view.min.js and view-modal.min.js are loaded.
  • Confirm that the modal is displayed when the hamburger is clicked.

Screenshots or screencast

@codesandbox
Copy link

codesandbox bot commented Nov 15, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@t-hamano t-hamano self-assigned this Nov 15, 2022
@t-hamano t-hamano added Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Block] Navigation Affects the Navigation Block labels Nov 15, 2022
@t-hamano t-hamano marked this pull request as ready for review November 15, 2022 15:07
Copy link
Member

@vcanales vcanales left a comment

Choose a reason for hiding this comment

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

Tested on Windows, LGTM.

@t-hamano t-hamano merged commit 7ceca91 into trunk Nov 16, 2022
@t-hamano t-hamano deleted the fix/plugin-nav-modal-enqueue branch November 16, 2022 13:27
@github-actions github-actions bot added this to the Gutenberg 14.7 milestone Nov 16, 2022
@bobbingwide
Copy link
Contributor

I haven't tested this myself yet. Does this solution work when Gutenberg is symlinked from a different folder?

@t-hamano
Copy link
Contributor Author

@bobbingwide
Symlinks were not tested in this PR. This PR is intended to unify delimiters by OS, and I think the original issue didn't report whether Gutenberg is symlinked or not, or whether it causes any problems.

If the problem occurs when the Gutenberg project is symlinked, then it would be a good idea to submit a new issue.

@DaisyOlsen DaisyOlsen added the [Type] Bug An existing feature does not function as intended label Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants