Page MenuHomePhabricator

VE: In the Edit dialog for links, when the “Done” button is disabled, the “Enter” key should be disabled as well
Closed, ResolvedPublic

Description

When editing an existing link to change the link target, if you enter a valid url in the External Link tab, the “Done” button becomes active/blue, and at that point you can insert the new link target either by clicking the button or by pressing Enter on your keyboard.

If you enter an invalid url, the “Done” button remains inactive/grayed-out, but pressing Enter still has an effect. It causes the dialog to close (the same as it would if you’d entered a valid url) and it changes the original linked text to plain text.

Steps to reproduce:

  1. Click on an existing link.
  2. In the pop-up dialog, click on Edit.
  3. In the Edit dialog, select the External Link tab.
  4. Type an invalid url (i.e., one without http:// or https://, such as "google.com") and press Enter on the keyboard. (The dialog disappears and the original link reverts to plain text.)

Hopefully there’s a way to disable the Enter key whenever the “Done” button is disabled. (If not, at least we shouldn’t revert the link to plain text when the user accidentally enters an invalid url.)

Event Timeline

Change 486330 had a related patch set uploaded (by DLynch; owner: DLynch):
[mediawiki/extensions/VisualEditor@master] MWLinkAnnotationInspector: check field validation before submitting with enter

https://gerrit.wikimedia.org/r/486330

matmarex added a subscriber: matmarex.

Thanks for the report!

After the patch, there remains one case where "Enter" will have an effect while the "Done" button is disabled: if the textfield is empty, pressing Enter will remove the link. This is intentional.

Change 486330 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] MWLinkAnnotationInspector: check field validation before submitting with enter

https://gerrit.wikimedia.org/r/486330