Skip to content
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 no longer works with the onFocus event #32415

Closed
lukecarbis opened this issue Jun 2, 2021 · 8 comments · Fixed by #47685
Closed

RichText no longer works with the onFocus event #32415

lukecarbis opened this issue Jun 2, 2021 · 8 comments · Fixed by #47685
Assignees
Labels
[Package] Rich text /packages/rich-text [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@lukecarbis
Copy link
Contributor

Description

In WordPress 5.7.2 (without the plugin), a RichText component can be passed the onFocus event, and it works as expected. Activating Gutenberg 10.7.1 breaks the onFocus functionality.

Step-by-step reproduction instructions

  1. Create a RichText component in a separate plugin or theme
  2. Give it an onFocus event, which logs something to the console
  3. Test it without the Gutenberg plugin installed (notice the text in the console)
  4. Test it with the Gutenberg plugin installed (the text no longer appears in the console)

Alternatively, here's a sandbox:
https://codesandbox.io/s/wp-richtext-onfocus-test-6r1eh?file=/src/App.js

  1. Open this sandbox
  2. Set the @wordpress/block-editor requirement to 6.1.1 or 6.1.0
  3. Notice that onFocus doesn't fire, and onBlur does
  4. Change the @wordpress/block-editor requirement to 6.0.0
  5. Notice that onFocus fires, and onBlur doesn't

Expected behaviour

RichText fields should trigger a given onFocus event when they receive focus.

Actual behaviour

RichText fields no longer trigger onFocus events (though they once did).

Code snippet (optional)

https://codesandbox.io/s/wp-richtext-onfocus-test-6r1eh?file=/src/App.js

WordPress information

  • WordPress version: 5.7.2
  • Gutenberg version: 10.7.1
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? Yes

Device information

  • Device: MacBook Pro
  • Operating system: MacOS Big Sur
  • Browser: Safari & Firefox
@lukecarbis lukecarbis added the [Type] Bug An existing feature does not function as intended label Jun 2, 2021
@lukecarbis
Copy link
Contributor Author

@ellatrix I hope you don't mind if I ping you on this – I believe you've been actively working on RichText.

@lukecarbis lukecarbis added the [Package] Rich text /packages/rich-text label Jun 2, 2021
@Thelmachido
Copy link

Hi @lukecarbis

As there hasn’t been any movement on this issue since it was opened, I’ve marked it as stale. Let me know if you think it should be kept open. Thanks!

@Thelmachido Thelmachido added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Aug 17, 2022
@kathrynwp kathrynwp added the [Status] Needs More Info Follow-up required in order to be actionable. label Sep 5, 2022
@ndiego
Copy link
Member

ndiego commented Jan 31, 2023

@lukecarbis just checking in. Would you be able to test with the latest version of the @wordpress/block-editor to see if this is still an issue? Thanks for your help!

@lukecarbis
Copy link
Contributor Author

@ndiego Yes – I'll do so today.

@lukecarbis
Copy link
Contributor Author

@ndiego After updating the code in the original sandbox to work with React 18, and using the latest version of all included scripts, this problem is still not fixed.

Sandbox using @wordpress/block-editor version 11.2.0

Let me know if there's anything further that you need.

@ndiego
Copy link
Member

ndiego commented Feb 1, 2023

Awesome, thanks for confirming @lukecarbis!

@ndiego ndiego removed [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. labels Feb 1, 2023
@ellatrix
Copy link
Member

ellatrix commented Feb 2, 2023

Does #47685 fix this?

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Feb 2, 2023
@lukecarbis
Copy link
Contributor Author

@ellatrix Yes, it does!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Rich text /packages/rich-text [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants