Mooeypoo has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/343750 )

Change subject: PopupWidget: Add 'ready' event when the popup is ready
......................................................................

PopupWidget: Add 'ready' event when the popup is ready

We already have the 'toggle' event denoting when the popup becomes
visible - however, this is usually not the proper place to handle
changes to the popup (especially things like scrollTop and displays)
because it is emitted - from the parent - before the popup positions
itself.

Adding 'ready' event after the popup is visible and positioned
will give developers who use the class the ability to hook to
the correct state of the popup (once it's already visible and
positioned and, most importantly, part of a scrollable container)

Change-Id: I19665f26177d4a654bd024a929537e02a40900ec
---
M src/widgets/PopupWidget.js
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/50/343750/1

diff --git a/src/widgets/PopupWidget.js b/src/widgets/PopupWidget.js
index d11961d..9931b9e 100644
--- a/src/widgets/PopupWidget.js
+++ b/src/widgets/PopupWidget.js
@@ -136,6 +136,14 @@
 OO.mixinClass( OO.ui.PopupWidget, OO.ui.mixin.ClippableElement );
 OO.mixinClass( OO.ui.PopupWidget, OO.ui.mixin.FloatableElement );
 
+/* Events */
+
+/**
+ * @event ready
+ *
+ * The popup is ready
+ */
+
 /* Methods */
 
 /**
@@ -254,6 +262,7 @@
  * Side-effects may include broken interface and exceptions being thrown. This 
wasn't always
  * strictly enforced, so currently it only generates a warning in the browser 
console.
  *
+ * @fires ready
  * @inheritdoc
  */
 OO.ui.PopupWidget.prototype.toggle = function ( show ) {
@@ -280,6 +289,7 @@
                        }
                        this.updateDimensions();
                        this.toggleClipping( true );
+                       this.emit( 'ready' );
                } else {
                        this.toggleClipping( false );
                        if ( this.autoClose ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I19665f26177d4a654bd024a929537e02a40900ec
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>

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

Reply via email to