gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Resets the Zoom on viewed/edited entity change

Open getdave opened this issue 4 months ago • 10 comments

What?

Follow up to https://github.com/WordPress/gutenberg/pull/65932.

Resets the Zoom Out when moving to view/edit a new entity. Avoids Zoom Out remaining engaged when navigating between Pages/Templates...etc in the Site Editor.

Why?

Retaining the Zoom Out state when moving between entities can be confusing and may lead to bugs when previewing in the frame.

For example, moving between Pages in the Site Editor leaves Zoom Out intact. That's confusing because Zoom Out is feels like it's an action taken when editing a given entity. It shouldn't persist.

I appreciate this is fairly opinionated so I'm happy to defer to @WordPress/gutenberg-design if they don't feel this is the right route.

How?

Dispatches appropriate actions to reset Zoom when syncing entity with URL.

I elected not to put this in the setEditedEntity action because I didn't want to couple these two concepts too tightly.

An alternative would be to reset Zoom Out if the Site Editor "frame" is opened (the black left hand sidebar with the W logo).

Testing Instructions

  • Site Editor -> Pages
  • Edit a Page
  • Engage Zoom Out
  • Open the frame and selected Pages again.
  • Click between Pages
  • See that Zoom Out is disengaged.

Testing Instructions for Keyboard

Screenshots or screencast

https://github.com/user-attachments/assets/2c167a03-dea1-4870-bd24-de82af6e2cbd

getdave avatar Oct 18 '24 10:10 getdave