Page MenuHomePhabricator

CapsuleMultiselectWidget.onInputBlur() called after Dialog.getActionProcess()
Closed, ResolvedPublic

Description

CapsuleMultiselectWidget creates items from text in Input Filed (by addItemFromLabel() function) when Enter key pressed and blur event emitted.
When submit button in a Dialog pressed ProcessDialog.getActionProcess() called before blur event emitted and CapsuleMultiselectWidget.getItems() does not return the last entered item since it was not created from input filed.

For example when config.allowArbitrary is true and a user entered text (Enter was not pressed) and pressed submit button in Dialog I expect that CapsuleMultiselectWidget.getItems() should return the item but it does not happen.

I fixed it by calling onInputBlur() before getItems() in my ProcessDialog.getActionProcess() function... But seems there should be better way...

Also seems it would be more optimized if onInputBlur() calls addItemFromLabel() only when this.$input is not empty.

OO.ui.CapsuleMultiselectWidget.prototype.onInputBlur = function () {
	this.addItemFromLabel( this.$input.val() );
	this.clearInput();
};

Event Timeline

Similar issue: T128054: ApiSandbox ignores last input unless it loses focus. Per the comments there, this should have been resolved for good. Do you still see this issue?

@Pastakhov One last call ^ before we put this on “Resolved”…?

Volker_E assigned this task to Anomie.