Page MenuHomePhabricator

ApiSandbox ignores last input unless it loses focus
Closed, ResolvedPublic


Widgets such as the multi input widget convert the inputted text into a box upon losing focus or pressing enter, to allow multiple separate texts to be added. If text has been input but not converted when the widget's content is requested, the unconverted text is ignored. Because the make request button does not take focus when clicked (perhaps this is more a OOUI bug, then), the last input does not get converted, and thus gets ignored in the request. Clicking the button a second time, or pressing enter or clicking somewhere else before clicking the button will work as expected.

Steps to reproduce:

  1. Enter text into a field such as titles, but do not press enter or click enterwhere else
  2. Press make request. Note that the text is ignored
  3. Press make request again. Note that the text is now included

Event Timeline

What's happening here is that OO.ui.ButtonWidget doesn't take focus when clicked, so the OO.ui.CapsuleMultiSelectWidget isn't getting a 'blur' event until after the request is done and the "Results" tab is focused.

I'm not sure whether that represents a bug in ApiSandbox or in oojs-ui. The "don't take focus" thing is clearly intentional, but this sort of bug seems likely to recur in all sorts of places if oojs-ui doesn't at least document how to easily work around it. @matmarex, any thoughts on that?

Change 273243 had a related patch set uploaded (by Anomie):
ApiSandbox: Blur before sending request

Change 273243 merged by jenkins-bot:
ApiSandbox: Blur before sending request

Anomie claimed this task.

The OOjs UI behavior changed per T76636, so that buttons now do take focus. The workaround can probably be reverted.