-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Patterns: check for prevent default on event to enable media placeholder button #73564
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
Conversation
…diting behavior - Updated logic to check if the click is outside the edited block before preventing default actions. - Ensured that default behavior (e.g., file dialogs) works when clicking inside the block. - Simplified the condition for stopping editing to enhance user experience.
|
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 If 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. |
|
Size Change: +4 B (0%) Total Size: 2.54 MB
ℹ️ View Unchanged
|
aaronrobertshaw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the fix @ramonjd 🚀
This is working as advertised for me:
✅ Could replicate original issue
✅ Can successfully upload images after applying fix
Screen.Recording.2025-11-26.at.12.27.52.pm.mp4
|
Thanks for the quick review! |
What?
Fixes #73563
Modifies use-edit-content-only-section-exit.js to only call
preventDefault()when clicking outside the edited section. Clicks inside the section now allow default behavior, so the file dialog opens.Why?
In content-only mode, clicking the "Upload" button in the media placeholder didn't open the file dialog because
event.preventDefault()was called for all clicks, even inside the edited section.Testing Instructions
Try for other media/file blocks:
Screenshots or screencast
Kapture.2025-11-26.at.12.47.15.mp4