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

Site Editor - Undo Trap from navigation-links in block patterns. #55198

Open
Addison-Stavlo opened this issue Aug 5, 2021 · 1 comment
Open
Labels
Needs triage Ticket needs to be triaged [Type] Bug

Comments

@Addison-Stavlo
Copy link
Contributor

Addison-Stavlo commented Aug 5, 2021

Steps to reproduce the behavior

  1. Visit the site editor on a valid test site.
  2. Insert a "Header" from the sidebar inserter.
  3. select "Create Header", choose a pattern and create.
  4. press the "undo" button, notice nothing is undone.

An undo trap has been created, preventing the user from being able to use 'undo' to undo the template part creation action or any actions prior to it.

Important notes:

  1. This does not happen if you select "start blank" instead of a starting pattern.
  2. This does not happen in core Gutenberg.
  3. After syncing the most recent Gutenberg trunk as of this morning to dotcom sandbox, the issue persists.
  4. This did not happen on dotcom a few weeks back, when e2e tests were written for the template part tracking flows.
  5. On trying to 'undo' it seems to trigger replaceInnerBlocks and editEntityRecord for the template part.
    Update:
    This only seems to happen when the pattern selected contains the navigation-link component. Try creating a Footer using a pattern without a navigation component and 'undo' should work as expected.

Can now reproduce on core if using a pattern containing navigation-links like so:

			<!-- wp:navigation {"orientation":"horizontal","itemsJustification":"center","align":"full","style":{"color":{"background":"#ececec"}}} -->
			<!-- wp:navigation-link {"label":"Home","url":"http:\/\/Home"} /-->

			<!-- wp:navigation-link {"label":"About","url":"http:\/\/About"} /-->

			<!-- wp:navigation-link {"label":"Contact","url":"http:\/\/Contact"} /-->
			<!-- /wp:navigation -->

Removing the navigation-link's from the pattern causes the undo to work as expected.

What I expected to happen

Undo to actually undo back to the placeholder:

undo-works-on-core

What actually happened

undo does not work as expected as it is caught in an undo trap with the navigation-link components.

@Addison-Stavlo Addison-Stavlo added [Type] Bug Needs triage Ticket needs to be triaged labels Aug 5, 2021
@Addison-Stavlo Addison-Stavlo changed the title Site Editor - Undo Trap from template part creation with block patterns. Site Editor - Undo Trap from navigation-links in block patterns. Aug 5, 2021
@Addison-Stavlo
Copy link
Contributor Author

note core issue exists here WordPress/gutenberg#33911

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs triage Ticket needs to be triaged [Type] Bug
Projects
None yet
Development

No branches or pull requests

1 participant