-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix padding appender hook #66143
Fix padding appender hook #66143
Conversation
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: +11 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
With this merged, #66080 can be rebased on trunk to prove the changed e2e test will pass. |
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.
LGTM! I've confirmed that it works correctly in both iframe and non-iframe editors.
Considering that the padding appender worked in 6.6.1 (see this comment), would it be ok to backport this PR to 6.7?
Thanks for the testing and review Aki 🫶
I think we’ll have to ask @kevin940726 or @getdave. The feature worked in 6.61 but was broken in 6.6.2 so I wasn’t sure if that disqualified it. |
I added the backport label 👍. |
@stokesman thanks for your in-depth (and I guess time-consuming!) investigation and for clarifying how this regressed ❤️ |
Thanks Kai! I’ll merge this. I expect it will likely need a manual backport though and if so I’m glad to handle that. |
* Fix focus inserted default block * Support clicks below the padding in the iframed editor Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: kevin940726 <kevin940726@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>
I just cherry-picked this PR to the wp/6.7 branch to get it included in the next release: bbf2aad |
* Fix focus inserted default block * Support clicks below the padding in the iframed editor Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: kevin940726 <kevin940726@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>
What?
Fixes for a couple bugs of the padding appender
Why?
How and how come?
Regarding the broken focus, it was due to a combination of #65414 and #64992. In #64992,
preventDefault
was replaced with astopPropagation
and fixed a couple odd issues but since #65414 it needs to go back topreventDefault
and that’s how it’s fixed here.The click below the padding didn’t work (in the iframed editor) for two reasons:
body
meant clicks below the padding were not caught because they are on thehtml
body
would still prevent appending even if the prior point is addressed.To fix it, the click listener is added to the document and, in its handler, the early return is avoided if the parent element (of the ref’d node) was the event target.
Testing Instructions
In the Post editor, both with and without the iframe:
Also, because the click listener is now at the document level it’s good to verify that in the non-iframed editor clicks in the editor UI that are below the last block don’t errantly insert a block.
Screenshots or screencast
A background color is applied to the "padding" to make it visible when clicking below that.
No iframe
click-below-no-iframe.mp4
iframe
click-below-iframe.mp4