WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.19k forks source link

Quick Edit - Slug Field: improve slug preview #66559

Closed gigitux closed 2 days ago

gigitux commented 3 days ago

What?

I noticed that the fallback logic for undefined slugs was missing, for instance draft pages. This PR implements a mechanism to provide a fallback slug when the slug is not defined.

Before After
image image

Why?

How?

Testing Instructions

Ensure that Quick Edit in DataViews and Quick Edit in DataViews are enabled. Ensure that you have a draft page without any title set.

  1. Visit the Site Editor.
  2. Click on pages.
  3. Toggle to the table view.
  4. Select the draft page that you created.
  5. Click on the settings.
  6. Click on details panel icon.
  7. Ensure that the link field is visible
  8. Click on it.
  9. Ensure that the slug preview is right. You should see the page ID.
  10. Update the slug.
  11. Save.
  12. Ensure that the page is visible to the new link.

Testing Instructions for Keyboard

Screenshots or screencast

github-actions[bot] commented 3 days ago

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: gigitux <gigitux@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org>

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

oandregal commented 3 days ago

How do I trigger the situation this PR fixes? I tried the steps in the description but couldn't. Tried with draft pages (even a new one I just created) but cannot run into the issue. I see the slug everywhere:

https://github.com/user-attachments/assets/407b7592-db80-4c63-b735-c4f90b96b9f4

gigitux commented 3 days ago

How do I trigger the situation this PR fixes? I tried the steps in the description but couldn't. Tried with draft pages (even a new one I just created) but cannot run into the issue. I see the slug everywhere:

Screen.Recording.2024-10-29.at.17.54.57.mov

Sorry for the oversight in the testing instructions. They are now updated. The issue occurs when you have a draft page without a title.

oandregal commented 3 days ago

I was able to reproduce this by adding a new Page from the wp-admin flow. If I create one from the site editor, it appears to be created with "no title" as title.

github-actions[bot] commented 2 days ago

Flaky tests detected in 51e08fe4754432017a7dd25c6c9d7f0031d67ac8. Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11594107744 📝 Reported issues: