Skip to content

Conversation

@yashjawale
Copy link
Contributor

@yashjawale yashjawale commented Aug 25, 2025

What?

Closes #71318

This PR moves navigation commands out of @wordpress/edit-site to the @wordpress/core-commands package.

The move makes the command available outside of site editor

Why?

There are some specific commands for the site editor. Some commands should be available outside the editor as well, since they are essentially navigations that involve changing the URL.
Part of efforts to make command palette available across the dashboard

How?

The relevant code related to navigation commands are moved to @wordpress/core-commands package

Also the labels of commands are updated with Go to _ prefix, except for Style revisions, View site

Testing Instructions

  1. Open a page where command palette is available except site editor
  2. Invoke command palette with Cmd/Ctrl + K & search for the above commands

Screenshots or screencast

image image

@yashjawale yashjawale marked this pull request as ready for review August 29, 2025 09:38
@github-actions
Copy link

github-actions bot commented Aug 29, 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: yashjawale <yashjawale@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>

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

@yashjawale
Copy link
Contributor Author

I've moved the command functions to core commands package but View custom CSS command doesn't appear to work, even if its navigating to proper URL
The custom CSS panel doesn't appear to open for me even if the URL param is present

@yashjawale yashjawale changed the title [WIP] Command Palette: Make navigation commands available on all screens Command Palette: Make navigation commands available on all screens Aug 29, 2025
@t-hamano
Copy link
Contributor

t-hamano commented Sep 2, 2025

Thanks for working on this PR!

I've moved the command functions to core commands package but View custom CSS command doesn't appear to work, even if its navigating to proper URL
The custom CSS panel doesn't appear to open for me even if the URL param is present

Sorry, I misunderstood.

In fact, the Additional screen doesn't exist if no custom styles are defined:

styles-section

This is why the panel won't open even when you run the correct URL from outside the site editor.

I remember there is an open PR that always enables the Additional CSS screen and a button to access it somewhere.

In this PR, I think it's okay to move the custom CSS commands back to the edit site. We can deal with it later.

@yashjawale
Copy link
Contributor Author

Thanks!
I'll make the necessary changes

@yashjawale
Copy link
Contributor Author

Updated ✅

@t-hamano
Copy link
Contributor

t-hamano commented Sep 3, 2025

@yashjawale Thanks for the update!

The changes look good, but this PR is slightly related to #71476 and will likely cause conflicts. Let's move forward with this PR while taking into account the situation in 71476.

Comment on lines 342 to 343
label: __( 'Pages' ),
label: __( 'Go to: Pages' ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately, it appears that the label overlaps with a command registered via the Menu API. Ideally, it should be moved to site-editor.php?p=%2Fpage in the site editor, but we may have no choice but to delete this command and move it to edit.php?post_type=page.

Image

cc @youknowriad

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's ok to remove the command for now.

The alternative is to override the other command (unregister it and register this one instead when we're in the site editor)

Copy link
Contributor

Choose a reason for hiding this comment

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

The alternative is to override the other command (unregister it and register this one instead when we're in the site editor)

@yashjawale Would you like to try this approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I'll give that a try

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For me unregistering didn't seem to work, it was getting registered again...
Instead I've tried to filter commands in admin-navigation-commands.js itself which worked

Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, I realized that we need a lot of code to override. In this PR, how about removing the "Go to: Pages" command from the edit-site and respecting the menu command? Perhaps we can try a better approach in a follow-up PR.

@t-hamano
Copy link
Contributor

t-hamano commented Sep 8, 2025

I've moved the command functions to core commands package but View custom CSS command doesn't appear to work, even if its navigating to proper URL
The custom CSS panel doesn't appear to open for me even if the URL param is present

Update: We should be able to address the problem above if #71537 is merged.

@yashjawale
Copy link
Contributor Author

Since #71537 is merged should I move custom CSS command back to core commands?

@t-hamano
Copy link
Contributor

t-hamano commented Sep 9, 2025

Since #71537 is merged should I move custom CSS command back to core commands?

I think this task can be addressed separately in a follow-up.

@t-hamano
Copy link
Contributor

t-hamano commented Sep 9, 2025

@yashjawale Can you delete this and this too?

After that, we should be able to ship this PR.

@yashjawale
Copy link
Contributor Author

Removed the override logic

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your work on this PR until the end.

@t-hamano t-hamano merged commit 0d75f88 into WordPress:trunk Sep 9, 2025
77 of 78 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.7 milestone Sep 9, 2025
talldan pushed a commit that referenced this pull request Sep 10, 2025
…71335)

* initial draft: move navigation commands to core commands

* Editor: Update command palette test for custom CSS navigation

* fix: move custom css commands back to edit-site

* fix: update custom CSS command label

Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>

* fix: update go to styles command label

Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>

* fix: update navigation command labels with colon

* fix: move commands from separate file to existing ones

* fix: re-add global styles navigation commands to site editor

* fix: remove redundant global styles navigation command from site editor

* fix: implement pages override command in site editor to resolve Menu API conflict

* fix: filter Pages command in site editor navigation

* Revert "fix: filter Pages command in site editor navigation"

This reverts commit 4612e34.

* revert: remove pages command override

---------

Co-authored-by: yashjawale <yashjawale@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
adamsilverstein pushed a commit to adamsilverstein/gutenberg that referenced this pull request Sep 11, 2025
…ordPress#71335)

* initial draft: move navigation commands to core commands

* Editor: Update command palette test for custom CSS navigation

* fix: move custom css commands back to edit-site

* fix: update custom CSS command label

Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>

* fix: update go to styles command label

Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>

* fix: update navigation command labels with colon

* fix: move commands from separate file to existing ones

* fix: re-add global styles navigation commands to site editor

* fix: remove redundant global styles navigation command from site editor

* fix: implement pages override command in site editor to resolve Menu API conflict

* fix: filter Pages command in site editor navigation

* Revert "fix: filter Pages command in site editor navigation"

This reverts commit 4612e34.

* revert: remove pages command override

---------

Co-authored-by: yashjawale <yashjawale@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command Palette: Make navigation commands available on all screens

3 participants