Page MenuHomePhabricator

Disable insert-link button when title is empty
Closed, ResolvedPublic1 Estimated Story Points

Description

The 'Insert link' button is disabled when an invalid page name is entered, but is enabled when the title input is empty (e.g. when the dialog is first opened). It does show an alert when trying to insert an empty title, but it'd be nicer to just now allow the button to be pressed (and so get rid of the alert altogether).

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptOct 13 2021, 2:29 AM
KSiebert set the point value for this task to 1.Nov 23 2021, 9:09 AM
KSiebert moved this task from Needs Discussion to Up Next (May 20-June 3) on the Community-Tech board.

Change 741996 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Disable link-insert button if target is empty

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

Samwilson changed the task status from Open to In Progress.Nov 27 2021, 12:47 AM

Change 741996 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Disable link-insert button if target is empty

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

@Samwilson If I close the Insert link dialog with some valid input, when I re-open it the insert-link button is disabled (even if the input is valid).

This does not happen in the parent commit (7fbd917c152ada0852a166ed97541472b874a963).

Open dialog first time, enter some valid input:

insert_link_disabled_step1.png (349ร—534 px, 24 KB)

Close the dialog (pressing cancel or x) and re-open it:

insert_link_disabled_step2.png (352ร—527 px, 22 KB)

Change 744902 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Fix link-inserter event value when dialog opens

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

Change 744902 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Fix link-inserter event value when dialog opens

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

I am a bit confused by the description in this task. Are we supposed to be seeing the alert when the link is empty?

This happens when I press enter (because the button is disabled):

empty_link_alert.png (468ร—1 px, 49 KB)

@Samwilson? @NRodriguez?

Notes for QA:

  1. Using the source editor, start editing any page on beta (e.g. https://en.wikipedia.beta.wmflabs.org/wiki/Special:Random)
  2. Open the "Insert link" dialog
    insert_link_menu_item.png (305ร—1 px, 44 KB)

The button that says "Insert link" should be disabled.

insert_link_disabled.png (323ร—523 px, 17 KB)

I am not sure what should happen if you press the enter key.

Please also read: Things to consider when testing

Insert button is disabled when title is blank. When user clicks on the disabled insert button nothing happens, the title field is highlighted in red.

Screen Shot 2021-12-21 at 3.43.23 PM.png (1ร—2 px, 320 KB)

I also confirmed that when user enters text, the insert button is enabled and insert link is enabled.
Screen Shot 2021-12-21 at 3.44.30 PM.png (1ร—2 px, 321 KB)