Page MenuHomePhabricator

"Insert link": Inconsistent validation logic
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

Depending on what circumstances you open the "Insert link" dialog, you can see different validation logic being applied to input.

See reproduction scenarios below.

Steps to reproduce problem

One:

  1. In the wikieditor, type [:<>] or [{{fullurl:{{FULLPAGENAME}}|action=edit}} Edit this page]
  2. Highlight it
  3. Open the "Insert link" dialog
  4. See it considers it as invalid
  5. Click the radio button labelled "To a wiki page"
  6. Click the radio button labelled "To an external web page"
  7. See it is now considered valid

Expected behavior: Behaviour in steps 4 and 7 should be the same. Either at both times it should be considered invalid or at both times considered valid.
Observed behavior: In spite both steps 4 and 7 having the external radio button selected, the validation logic is not the same.

Two:

  1. In the wikieditor, type [[Foo%20bar]]
  2. Highlight it
  3. Open the "Insert link" dialog
  4. See it considers it as invalid
  5. Click the radio button labelled "To an external web page"
  6. Close the dialog
  7. With the text still highlighted, open the dialog again
  8. See it is now considered valid

Expected behavior: Behaviour in steps 4 and 8 should be the same.
Observed behavior: Steps 4 and 8 both have the internal link radio selected, but the validation is not the same.

Three:

  1. Open the "Insert link" dialog
  2. In the first input field, type https://en.wikipedia.beta.wmflabs.org/wiki/Foo%20bar
  3. Click the "Insert link" button
  4. In the popup that appears, click the "Internal link" button

Expected behavior: The input changes to "Foo%20bar" and is considered invalid. This is what happens normally when you enter "Foo%20bar" from scratch in the input.
Observed behavior: The input changes to "Foo%20bar" but is considered valid.

Environment

Browser: Firefox 91
Wiki(s): https://en.wikipedia.beta.wmflabs.org MediaWiki 1.38.0-alpha (82d4dab) 06:59, 21 February 2022.
Editor: WikiEditor 0.5.3 (3fa6f08) 07:13, 16 February 2022.

Event Timeline

Change 764404 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/WikiEditor@master] dialogs: Set url mode of title field when switching between modes automatically

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

Change 764404 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] insertlink: Set url mode of title field when switching between modes automatically

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

dom_walden claimed this task.
dom_walden moved this task from Backlog to Closed on the WikiEditor board.

I cannot reproduce bugs one or three anymore.

Bug two does not behave the same way as before, I think due to T302196. At step 7, when reopening the dialog the "To an external link" radio is still selected but the input is considered invalid. This isn't quite right. However, I don't think it is that big a problem and hopefully it will be fixed with T302196.

I am marking this as resolved.

Test environment: https://en.wikipedia.beta.wmflabs.org WikiEditor 0.5.3 (c23c11a) 06:45, 3 May 2022.