Page MenuHomePhabricator

When you follow a link to create a Test case for a given Function, we pre-select that target and don't change that if you search for but don't select a different target
Closed, ResolvedPublicBUG REPORT

Description

There is an "If" string that overrides the "Select function" placeholder text on the Create a new test page

Currently, the behavior is that even when the default value "If" is present, then no results display, and to get results to display in the cdx-menu__listbox, the user needs to remove the "If" string and then retype it, or else if will show "No results found"

We should instead remove the "If" and display the placeholder.

Acceptance criteria:
Default "If" string that overrides the placeholder of "Select function" should be removed. The placeholder text of "Select function" should display instead.

Current behavior (needs changed)
Screen Recording 2025-07-01 at 12.41.38 PM.gif (1×2 px, 423 KB)

Event Timeline

vaughnwalters changed the subtype of this task from "Task" to "Bug Report".Jul 2 2025, 3:24 PM

Change #1189496 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] ZObjectSelector: Improve lookup results fetching

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

DSmit-WMF changed the task status from Open to In Progress.Sep 19 2025, 1:59 PM
DSmit-WMF claimed this task.

I am not convinced we should 'remove the If and show the placeholder'. Its a prefilled value. I did make it so the api starts fetching the lookup results once the user focuses the field (onFocus).

Jdforrester-WMF renamed this task from Remove "If" that overrides the "Select function" placeholder to When you follow a link to create a Test case for a given Function, we pre-select that target and don't change that if you search for but don't select a different target.Sep 19 2025, 2:38 PM
Jdforrester-WMF subscribed.

I've re-titled the task as I understand it. Does that match your thinking, @DSmit-WMF? Changing the selector to run the search without input if pre-filled makes sense to me. @vaughnwalters, would that resolve your concern?

I am not sure about this, with https://phabricator.wikimedia.org/T398453 we removed the "No search results" when there was indeed a selected search result.
With triggering the search there's a little strange state update between current item and sudden replacement of search results:

weird-zobject-search-triggered.gif (740×655 px, 505 KB)

What are we trying to accomplish? What's the wanted behavior?

If we want to trigger search on focus, I would advice removing the behavior added in T398453: When clicking on a just-initialized lookup component which has an existing value, don't show "No results found" and totally replacing it with the lookup call, so avoid this kind of strange double update.

@DSmit-WMF what do you think?

Just my opinion, but changing the function while creating a new test case doesn’t make sense in the user journey. That field should be fixed during creation. The current behaviour, where changing the function obliterates the function call and result validation without warning, is not helpful.

It should only be possible to change the function when editing an existing test case. Since changing the function in a function call always requires the whole call to be rebuilt, the only content that can currently be usably transferred is the result validation. Those specifications can be complex, so it would be helpful to allow them to be copied to other test cases in future. Until then, I’d keep the ability to transfer an existing test case to a different function. (Of course, being able to just replace the function in the existing call with another function that has a compatible signature would be fantastic!)

If a non-trivial test case is created under the wrong function, the workaround is to publish it as-is and then transfer it to the correct function in a later edit (when changing the function does not reset the saved call and result validation).

The interaction with excludeZids that I mentioned in the gerrit task:
In this little demo you can see:

  1. ZObjectSelector for a language in the context of a Multilingual string component; selected item does not appear in blue in the lookup dropdown.
  2. ZObjectSelector for a language outside of a Multilingual string (just a stand-alone Monolingual): selected item does appear as selected.

The excludeZids from Multilingual adds languages for them to be excluded from the selection, which means that "selectedZid" does never appear.

exclude-zids.gif (876×976 px, 1 MB)

Change #1189496 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] ZObjectSelector: Improve lookup results fetching

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

Screenshot 2025-10-23 at 12.44.02.png (854×674 px, 48 KB)

Checked on wikifunctions.org and its fetching the results for 'if' on focus of the field.