-
Notifications
You must be signed in to change notification settings - Fork 4.6k
RichText: Don't forget ref passing in Preview mode #73062
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
Let RichText forward the ref that it receives to the element it returns, even when this element is the lightweight alternative returned when the block editor is in preview mode. Fixes any kind of bug arising from the fact that refs passed to RichText were ignored when the block editor is in preview mode. Particularly, `useBlockProps`, with its many merged refs, was systematically ignored. This was revealed while debugging the bug that #73020 sought to fix: `useBlockElement` could never return elements because the ref callback of `useBlockElementRef` was never called.
|
Size Change: +1 B (0%) Total Size: 2.47 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 8488adf. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19144121533
|
jorgefilipecosta
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.
Everything worked great on my tests. Thank you for this fix
|
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. |
Let RichText forward the ref that it receives to the element it returns, even when this element is the lightweight alternative returned when the block editor is in preview mode. Fixes any kind of bug arising from the fact that refs passed to RichText were ignored when the block editor is in preview mode. Particularly, `useBlockProps`, with its many merged refs, was systematically ignored. This was revealed while debugging the bug that #73020 sought to fix: `useBlockElement` could never return elements because the ref callback of `useBlockElementRef` was never called. Co-authored-by: mcsf <[email protected]> Co-authored-by: jorgefilipecosta <[email protected]>
|
I just cherry-picked this PR to the wp/6.9 branch to get it included in the next release: ae3b0fd |
|
Great catch! |
|
Thank you for working on this. |
What
Alternative to #73020
Bug introduced in #60544
Let RichText forward the ref that it receives to the element it returns, even when this element is the lightweight alternative returned when the block editor is in preview mode.
Why?
Fixes any kind of bug arising from the fact that refs passed to RichText were ignored when the block editor is in preview mode. Particularly,
useBlockProps, with its many merged refs, was systematically ignored.This was revealed while debugging the bug that #73020 sought to fix:
useBlockElementcould never return elements because the ref callback ofuseBlockElementRefwas never called.Testing Instructions