Repository navigation
Editor: Use preventDefault() for the unsaved changes warning - #86506
Merged
Merged
Conversation
Browsers ignore custom beforeunload text, so drop the unused string. Keep returnValue as a fallback for Chrome before 119. Update the trash race comment to match the current redirect location. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: -79 B (0%) Total Size: 8.61 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
|
Member
Author
|
Going to merge this; failure is unrelated; trying to fix it in #86511. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Triggers the unsaved changes
beforeunloadwarning withevent.preventDefault()in the editor and the widgets screen, and removes the custom warning string.Why?
Browsers stopped showing page-provided
beforeunloadtext in 2016 and show their own message instead, so the string was never displayed but still needed translating.preventDefault()is the standard trigger now, andreturnValuestays as a fallback for Chrome before 119.Testing Instructions
change-detection.spec.jsandediting-widgets.spec.jspass in Chromium.Use of AI Tools
Authored with Claude Code (Claude Opus 5.5), reviewed by the author.
🤖 Generated with Claude Code