Page MenuHomePhabricator

Pressing escape twice to cancel out of the link inspector, closes the entire media dialog
Closed, ResolvedPublic

Description

When typing a caption with a link, into the media dialog, if I hit [Esc] twice in order to cancel the link inspector, it closes the entire media dialog.
See screencast attached: (1.4mb - if you can't see it here, right-click "save link as" on the "view file" link at top-right of F182277).

Steps to reproduce:

  • Open media dialog.
  • insert image
  • start typing caption
  • begin to create a link, but then change your mind and try to close it with [Esc] key (once if you haven't typed anything in the link inspector, or twice if you have)
  • whole media dialog closes.

In contrast, clicking [Esc] twice within the link inspector (once you've started typing in the link inspector, or clicking once if you haven't), whilst editing an article, will just close the link inspector.

Confirmed in Firefox 38 and Chromium 37, on Ubuntu. Originally reported as a single press of the Escape key on Firefox 38 on Windows with an Icelandic keyboard.

Event Timeline

Quiddity raised the priority of this task from to Needs Triage.
Quiddity updated the task description. (Show Details)
Quiddity subscribed.
Jdforrester-WMF subscribed.

In contrast, clicking [Esc] twice within the link inspector (once you've started typing in the link inspector, or clicking once if you haven't), whilst editing an article, will just close the link inspector.

Won't it close the editor?

Seems to be something to do with the OO.ui.Dialog code. I tried changing the onDocumentKeyDown function there to log this.constructor.name, and it prints VeUiMWMediaDialog followed by VeUiMWLinkAnnotationInspector.
Why is it backwards, and how can the second happen as first called preventDefault+stopPropagation?

Ah. That event is actually attached to the whole document.

In contrast, clicking [Esc] twice within the link inspector (once you've started typing in the link inspector, or clicking once if you haven't), whilst editing an article, will just close the link inspector.

Won't it close the editor?

ah, it varies depending on whether the autocomplete dropdown list is active.
If it is, then the first [Esc] will exit the autocomplete, and the second [Esc] will exit the link inspector. (e.g. if I type "test" in a link inspector at http://en.wikipedia.beta.wmflabs.org/wiki/User:Jdforrester_%28WMF%29/Sandbox?veaction=edit ).

Esanders claimed this task.
Esanders subscribed.

This has been fixed for a while.