Page MenuHomePhabricator

[wmf.22] Add image: Uncaught TypeError: Cannot read properties of undefined (reading 'focus') - Suggestion surface is lost
Open, MediumPublicBUG REPORT



  • On wiki with Add image suggestion enabled (cswiki, arwiki) go to an article with Add image suggestion
  • Say 'yes' to add an image
  • Type some text into the caption (could be less than 5 characters) - move the cursor to the beginning of the entered text and press delete.

What happens?:

  • the Suggestion surface will be lost. A user needs to reload the page to return to the Suggestion mode.
  • the Console displays the following error:
Uncaught TypeError: Cannot read properties of undefined (reading 'focus')

at ve.ce.Surface.focus
at ve.ce.LinearDeleteKeyDownHandler.static.execute 
at AddImageLinearDeleteKeyDownHandler.static.execute
at ve.ce.KeyDownHandlerFactory.executeHandlersForKey
at ve.ce.Surface.onDocumentKeyDown
at ve.EventSequencer.callListener 
at ve.EventSequencer.onEvent

What should have happened instead?:

  • any reasonable user actions (interactions) should not make Suggestions mode disappear

The animated gif below shows:

  • On arwiki the image is accepted - clicked 'yes'
  • In the caption field - testing is typed
  • The mouse cursor is moved to the beginning of the word testing and Delete key is pressed.

Note: the issue is not specific to arwiki - it was confirmed for cswiki too.

add_image_disappear.gif (627×1 px, 2 MB)