-
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
RichText: add onBlur prop to so onBlur callback from block-editor can be plumbed through #30587
Conversation
…or can be plumbed through
Size Change: +7 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
Thanks for looking into this @glendaviesnz ! I applied the latest patch from #30407 to this branch. The image caption blurs as expected: I added a Once this goes through we could add a handler to the gallery caption field as well 🎉 |
…ur from the caption field. To do this we add an onBlur event to the RichText block based on the work so far in WordPress#30587, which fires an onBlur handler passed as a prop.
@ellatrix did you have any thoughts on this? do you know if there was a reason why the onBlur prop was not plumbed through from the |
I'm not sure if we can simply use onBlur to set selection state. What if focus moves to the toolbar? |
Good point, will take another look at it with that in mind. |
Closing or now. As @ellatrix pointed out it is not possible to know if the blur was caused by a click on the richtext toolbar. |
@glendaviesnz Btw, I'm refactoring rich text and in a few more PRs, I'll make it possible to use |
@glendaviesnz Actually, I don't think we even need it. I removed all caption focus handling from the image and gallery block in #31796 and absorbed it into the block editor with a one liner. |
Description
The block-editor RichText wrapper has an onBlur prop available, but this is ignored by the underlying RichText package, so there is no way to pass through an onBlur callback from blocks that make use of RichText.
This prevents easy handling of the isSelected state to do the likes of removing the formatting toolbar when the control is blurred, eg. #30334
How has this been tested?
Has been tested manually against #30407
Types of changes
Plumbs through an optional onBlur prop which is called on component blur event
Checklist: