Gutenberg: Entire block's content deleted on single backspace in Firefox when the plugin is active

Created on 20 Feb 2019  路  8Comments  路  Source: WordPress/gutenberg

Describe the bug
Clicking backspace to delete a single character results in an entire block's content being removed.

To Reproduce
Steps to reproduce the behavior:

  1. Go to A New Post with the Gutenberg Editor
  2. Begin typing anything into the empty block
  3. Hit backspace
  4. Entire block's content deleted.

Expected behavior
I would expect for a single character to be deleted.

Desktop (please complete the following information):

  • OS: Windows 10 Version 1809 Build 17763.316
  • Browser: Firefox
  • Version: 65.0

Additional context

  • Gutenberg 5.1.0
  • WordPress 5.0.3
  • Firefox extensions: 1Password, LastPass, Inoreader
Browser Issues [Feature] Writing Flow [Priority] High [Type] Bug

All 8 comments

After a git bisect, It appears that this was introduced in c17239fb5f5a09eae863880dc452a1b045539300

Sorry, I started with a bad commit on this, so it's sometime earlier than that.

What I missed in further testing is that it is only when typing in a new block. Once you move focus away from the block and come back, you can delete single characters at a time.

Tested and confirmed using WordPress 5.0.3 and Gutenberg 5.1.0 hosted at https://jurassic.ninja/ using Firefox 65.0 on macOS 10.13.6.

Note: this problem only happens when the plugin is active and only in Firefox.

13979-5s

Console log is getting the following error, looks like for every key press:

TypeError: t is undefined index.js:50:162547

cc @iseulde

@earnjam c17239f should only affect the native mobile apps if I understand correctly.

@earnjam c17239f should only affect the native mobile apps if I understand correctly.

Yep, sorry updated my comment above. I discovered some specific circumstances of the issue that made it appear the commit before that was working.

Error occurs at this line:

https://github.com/WordPress/gutenberg/blob/f81d0d7dc41779a95d164098eabb219a95df5970/packages/editor/src/components/rich-text/index.js#L376

TypeError: inputType is undefined[Learn More]

Quite likely related to changes introduced as part of #13833 (cc @iseulde @noisysocks )

Per the following, only Chrome and Safari have support for InputEvent#inputType:

https://developer.mozilla.org/en-US/docs/Web/API/InputEvent/inputType#Browser_compatibility

A not-so-great "workaround" (more to the point of confirming the above) is to enter this in your browser console when loading the editor:

window.addEventListener( 'input', ( e ) => e.inputType = '', true )

Fix proposed at #13986

Was this page helpful?
0 / 5 - 0 ratings