Skip to content

Conversation

@jacobsfletch
Copy link
Member

@jacobsfletch jacobsfletch commented Jun 26, 2025

Partially closes #12121.

When you edit a document in Live Preview using the default iframe window, then attempt to open the window as a popup, the LeaveWithoutSaving modal will appear.

This is because the usePreventLeave hook watches for anchor tags that might cause a page navigation, and rightfully warns the user before they navigate away and lose their changes. The reason the popup button triggers this hook is because it uses an anchor tag with an href for accessibility, which fires events that are caught and processed by the hook.

The fix is to add the target="_blank" attribute here so that the hook understands that these events do not navigate the user away from the page and can be ignored.


@jacobsfletch jacobsfletch enabled auto-merge (squash) June 26, 2025 16:22
@jacobsfletch jacobsfletch merged commit 141133a into main Jun 26, 2025
161 of 163 checks passed
@jacobsfletch jacobsfletch deleted the fix/live-preview-popup branch June 26, 2025 16:59
@github-actions
Copy link
Contributor

🚀 This is included in version v3.44.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment