jenkins-bot has submitted this change and it was merged.

Change subject: CapsuleMultiselectWidget: Fix crash on right-click when no input
......................................................................


CapsuleMultiselectWidget: Fix crash on right-click when no input

We are defining this.$input as either null or an input, and yet
on focus/unfocus operations there's a call for resize which
assumes this.$input is a jQuery $( '<input>' ) and tries to manipulate
and calculate data from it.

In general we should allow for an $input in the capsule even if
there's a popup (and have the filtering option as an API the dev
will implement, similar to having to implement the API to add items
from the popup instead of the menu) -- but while we don't allow
for that, any operation on the $input should be guarded.

Change-Id: I464c0ac2a2f6b0129e076037212dfc672e679a4c
---
M src/widgets/CapsuleMultiselectWidget.js
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/widgets/CapsuleMultiselectWidget.js 
b/src/widgets/CapsuleMultiselectWidget.js
index 833969f..e915d99 100644
--- a/src/widgets/CapsuleMultiselectWidget.js
+++ b/src/widgets/CapsuleMultiselectWidget.js
@@ -625,7 +625,7 @@
  */
 OO.ui.CapsuleMultiselectWidget.prototype.updateInputSize = function () {
        var $lastItem, direction, contentWidth, currentWidth, bestWidth;
-       if ( !this.isDisabled() ) {
+       if ( this.$input && !this.isDisabled() ) {
                this.$input.css( 'width', '1em' );
                $lastItem = this.$group.children().last();
                direction = OO.ui.Element.static.getDir( this.$handle );

-- 
To view, visit https://gerrit.wikimedia.org/r/320528
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I464c0ac2a2f6b0129e076037212dfc672e679a4c
Gerrit-PatchSet: 3
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to